gemini-code-assist[bot] commented on code in PR #20028:
URL: https://github.com/apache/tvm/pull/20028#discussion_r3608971763
##########
tests/python/codegen/test_target_codegen_vulkan.py:
##########
@@ -86,6 +88,64 @@ def main(A: T.Buffer((1024,), dtype), B: T.Buffer((1024,),
dtype)):
assert len(matches) == 1
[email protected]
[email protected](
+ not tvm.testing.device_enabled(
+ {
+ "kind": "vulkan",
+ "supports_storage_buffer_storage_class": 1,
+ }
+ ),
+ reason="vulkan not enabled",
+)
+def test_spirv_15_storage_buffer_entry_point_interfaces(tmp_path):
+ """Validate a minimal storage-buffer kernel as SPIR-V 1.5 for Vulkan
1.2."""
+ spirv_as = shutil.which("spirv-as")
+ spirv_val = shutil.which("spirv-val")
+ if spirv_as is None or spirv_val is None:
+ pytest.skip("spirv-as and spirv-val are required")
+
+ target = tvm.target.Target(
+ {
+ "kind": "vulkan",
+ "vulkan_api_version": (1 << 22) | (2 << 12),
+ "max_spirv_version": 0x10500,
+ "supports_storage_buffer_storage_class": 1,
+ }
+ )
+
+ @I.ir_module(s_tir=True)
+ class Module:
+ @T.prim_func(s_tir=True)
+ def main(A: T.Buffer((1,), "float32"), B: T.Buffer((1,), "float32")):
+ for i in T.thread_binding(1, thread="threadIdx.x"):
+ B[i] = A[i] + T.float32(1)
+
+ executable = tvm.tirx.build(Module, target=target)
+ assembly = executable.imports[0].inspect_source()
+ assert "; Version: 1.5" in assembly
+ assembly_path = tmp_path / "storage_buffer.spvasm"
+ binary_path = tmp_path / "storage_buffer.spv"
+ assembly_path.write_text(assembly, encoding="utf-8")
+
+ # TVM currently emits a SPIR-V 1.0 header even when the target supports
+ # SPIR-V 1.5. Reassembling the generated instructions for SPIR-V 1.5
+ # makes spirv-val enforce the Vulkan 1.2 entry-point interface rules.
Review Comment:

The comment states that 'TVM currently emits a SPIR-V 1.0 header even when
the target supports SPIR-V 1.5.' However, this PR specifically fixes this
behavior so that TVM now correctly emits the requested SPIR-V version (e.g.,
1.5) in the header. This comment should be updated to reflect the new correct
behavior.
```suggestion
# Reassembling the generated instructions for SPIR-V 1.5
# makes spirv-val enforce the Vulkan 1.2 entry-point interface rules.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]