All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 5/8] gpu: nova-core: add NVKV decoder
Date: Thu, 10 Sep 2026 16:47:48 +0900	[thread overview]
Message-ID: <DLBGYDIEZY9O.13PCPPFAA7JN9@nvidia.com> (raw)
In-Reply-To: <20260827-b4-nvkv-v2-5-0de9d5c8658c@nvidia.com>

On Thu Aug 27, 2026 at 11:12 PM JST, Eliot Courtney wrote:
<...>
> +    /// Decodes every pair into `schema` and returns the result of [`Schema::finish`].
> +    pub(crate) fn decode<'s, S: Schema>(
> +        &self,
> +        schema: &'s mut S,
> +    ) -> Result<impl Init<S::Target, Error> + 's> {
> +        let mut cursor = Cursor::new(self.data);
> +        while !cursor.is_empty() {
> +            let op: Op = cursor.take_u64()?.into();
> +
> +            let key = op.key().into();
> +            let index = op.index();
> +            let op_value: u32 = op.value().into();
> +            match op.opcode()? {
> +                Opcode::Imm32 => {
> +                    self.visit(schema, key, index, DecoderValue::Scalar32(op_value))?;
> +                }
> +                Opcode::Seq32 => {
> +                    let values = cursor.take_u32s(num::u32_as_usize(op_value))?;
> +                    for (i, &value) in values.iter().enumerate() {
> +                        let key = Self::seq_key(key, i)?;
> +                        self.visit(schema, key, index, DecoderValue::Scalar32(value))?;
> +                    }
> +                }
> +                Opcode::Seq64 => {
> +                    let values = cursor.take_u64s(num::u32_as_usize(op_value))?;
> +                    for (i, &value) in values.iter().enumerate() {
> +                        let key = Self::seq_key(key, i)?;
> +                        self.visit(schema, key, index, DecoderValue::Scalar64(value))?;
> +                    }
> +                }

Another thing that could be worth clarifying: are `Seq32`/`Seq64` with a
count of `0` valid? Right now they won't trigger a visit or an error,
i.e. they will be silently ignored. Whereas arrays of size 0 do trigger
a visit (which sounds logical). I'm not saying this is a problem, just
wondering if the behavior is consistent with what NVKV specifies in such
cases.

  parent reply	other threads:[~2026-09-10  7:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 14:12 [PATCH v2 0/8] gpu: nova-core: add NVKV codec Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 1/8] rust: alloc: add Vec::try_push_init Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 2/8] rust: alloc: add Vec::push_init Eliot Courtney
2026-08-27 14:30   ` sashiko-bot
2026-08-27 14:12 ` [PATCH v2 3/8] rust: alloc: add ArrayVec Eliot Courtney
2026-08-27 14:33   ` sashiko-bot
2026-08-27 14:12 ` [PATCH v2 4/8] gpu: nova-core: add NVKV encoder Eliot Courtney
2026-08-27 14:35   ` sashiko-bot
2026-09-07 15:07   ` Alexandre Courbot
2026-08-27 14:12 ` [PATCH v2 5/8] gpu: nova-core: add NVKV decoder Eliot Courtney
2026-08-27 14:36   ` sashiko-bot
2026-09-09  0:51   ` Alexandre Courbot
2026-09-09  1:13     ` Eliot Courtney
2026-09-09  4:48       ` Alexandre Courbot
2026-09-10  7:47   ` Alexandre Courbot [this message]
2026-08-27 14:12 ` [PATCH v2 6/8] gpu: nova-core: add NVKV typed encoding Eliot Courtney
2026-09-10  8:10   ` Alexandre Courbot
2026-09-11  5:17     ` Alexandre Courbot
2026-09-11  5:28       ` Eliot Courtney
2026-09-11 11:18         ` Alexandre Courbot
2026-08-27 14:12 ` [PATCH v2 7/8] gpu: nova-core: add NVKV typed decoding Eliot Courtney
2026-08-27 14:12 ` [PATCH v2 8/8] gpu: nova-core: add NVKV GSP_INIT schemas Eliot Courtney
2026-08-27 14:34   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DLBGYDIEZY9O.13PCPPFAA7JN9@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.