Skip to content

SET KERNEL only copies the first byte #814

@jrprice

Description

@jrprice

SET KERNEL only copies the first byte of the kernel argument to the buffer. Reproducer script:

kernel void foo(global int* out, int value) {
  *out = value;
}
END

BUFFER out_buf DATA_TYPE uint32 DATA 0 END

PIPELINE compute p1
  ATTACH my_shader ENTRY_POINT foo
  BIND BUFFER out_buf KERNEL ARG_NAME out
  SET KERNEL ARG_NAME value AS int32 300
END

RUN p1 1 1 1

EXPECT out_buf IDX 0 EQ 300

Running this yields:
Line 32: Verifier failed: 44 == 300, at index 0
(44 is 300-256)

I believe this is because the buffer is created as R8_UINT, and the Buffer::SetDataWithOffset(Value) method uses the format to determine how many bytes to copy to the buffer, not the size of the values passed to it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions