wilx opened a new pull request, #20028:
URL: https://github.com/apache/tvm/pull/20028

   ## What changed
   
   This updates Vulkan code generation for targets requesting SPIR-V 1.4 or 
newer:
   
   - propagate `max_spirv_version` into `SPIRVSupport` and emit that version in 
the SPIR-V header;
   - track storage-buffer arguments, uniform buffers, push constants, and other 
module-scope variables;
   - include those variables in the `OpEntryPoint` interface list for SPIR-V 
1.4+;
   - retain TVM's historical SPIR-V 1.0 output for older targets; and
   - add a minimal SPIR-V 1.5/Vulkan 1.2 conformance regression test.
   
   ## Why this is necessary
   
   SPIR-V 1.4 changed the `OpEntryPoint` contract: every module-scope variable 
used by an entry point must be listed in its interface operands. TVM previously 
listed only built-in variables.
   
   TVM also always emitted a SPIR-V 1.0 header, even when the Vulkan target 
advertised SPIR-V 1.5. That caused validation to use the older rules and masked 
the incomplete interface list. Reassembling a generated storage-buffer kernel 
as SPIR-V 1.5 and validating it for Vulkan 1.2 produced:
   
   ```text
   Interface variable id <4> is used by entry point 'main_kernel' id <2>,
   but is not listed as an interface
   %A_ptr = OpVariable ... StorageBuffer
   ```
   
   The regression test uses the smallest useful kernel, `B[0] = A[0] + 1`. It 
requires a SPIR-V 1.5 header, reassembles the generated instructions with 
`spirv-as`, and independently validates them with `spirv-val --target-env 
vulkan1.2`. The test skips when those SPIR-V Tools executables are unavailable.
   
   After the fix, its entry point contains both storage buffers:
   
   ```text
   OpEntryPoint GLCompute ... "main_kernel" %BuiltInLocalInvocationId %A_ptr 
%B_ptr
   ```
   
   ## Validation
   
   - Built TVM's Vulkan and LLVM-enabled compiler successfully.
   - Ran the complete Vulkan codegen test module:
   
     ```text
     31 passed, 24 skipped
     ```
   
   - Confirmed `git diff --check` passes.
   


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