tqchen commented on code in PR #20028:
URL: https://github.com/apache/tvm/pull/20028#discussion_r3610498126


##########
tests/python/codegen/test_target_codegen_vulkan.py:
##########
@@ -86,6 +88,63 @@ 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")
+
+    # Reassembling the generated instructions for SPIR-V 1.5

Review Comment:
   given this depends on spriv tools, i would skip this test, instead rely on 
local validaiton that the patch works



-- 
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]

Reply via email to