Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge (conflict) bafc886 [SPV-IR] Fix SPIRV builtin variable/call tra…
…nslation (KhronosGroup#1133) 'master' -> 'xmain-web' (KhronosGroup#3) CONFLICT (content): Merge conflict in lib/SPIRV/SPIRVInternal.h commit bafc886 Author: Yilong Guo <[email protected]> Date: Tue Aug 3 15:25:57 2021 +0800 [SPV-IR] Fix SPIRV builtin variable/call translation (KhronosGroup#1133) This PR fixes the translation of SPIRV builtin variables/calls. The translator now is able to recognize builtin-call-based SPV-IR input. e.g. `call spir_func i64 @_Z33__spirv_BuiltinGlobalInvocationIdi(i32 1)` ### LLVM --> SPIRV translation: We first translate OCL work item builtins to SPV-IR builtin calls in `OCLToSPIRV`. For example: `@_Z13get_global_idj(i) -> @_Z33__spirv_BuiltinGlobalInvocationIdi(i)` SPV-IR builtin calls are transformed to variables in `LLVMToSPIRV`. This step is shared by all source inputs (SPV-IR, OCL-IR). For example: `@_Z33__spirv_BuiltinGlobalInvocationIdi(i) -> x = load GlobalInvocationId; extract x, i` ### SPIRV --> LLVM translation: We lower SPIRV builtin variables into calls in `SPIRVToLLVM` so that SPV-IR has builtin function calls (instead of variables) by default. Builtin calls in SPV-IR can be then translated into OpenCL builtin calls, in `SPIRVToOCL`. e.g. `@_Z33__spirv_BuiltinGlobalInvocationIdi(i) -> @_Z13get_global_idj(i)` `SPIRVToOCL` is also capable of lower SPIRV builtin variables into calls as preprocessing, so that this pass can be used by users independently to translate SPV-IR into OCL-IR. Signed-off-by: Yilong Guo [email protected] Change-Id: Ie361b71607ba37677d7634f33f55e7286cee673f
- Loading branch information