-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V 1.2] SPIRVReader: Add MaxByteOffsetId support
If there is no `OpDecorate .. MaxByteOffset` in the input, see if there is an `OpDecorateId .. MaxByteOffsetId` and take the value for the LLVM `dereferenceable` attribute from the referenced constant instead. Once `MaxByteOffsetId` has been translated to LLVM IR, it is indistinguishable from a (non-ID) `MaxByteOffset` decoration.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
; REQUIRES: spirv-as | ||
|
||
; RUN: spirv-as %s --target-env spv1.2 -o %t.spv | ||
; RUN: spirv-val %t.spv | ||
; RUN: llvm-spirv -r -o %t.rev.bc %t.spv | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s | ||
|
||
; CHECK: define spir_kernel void @testMaxByteOffsetId( | ||
; CHECK-SAME: ptr addrspace(1) dereferenceable(24) %p, | ||
; CHECK-SAME: ptr addrspace(1) dereferenceable(48) %q) | ||
|
||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %fn "testMaxByteOffsetId" | ||
OpName %p "p" | ||
OpName %q "q" | ||
OpDecorateId %p MaxByteOffsetId %mbo | ||
OpDecorateId %q MaxByteOffsetId %spec | ||
%void = OpTypeVoid | ||
%i32 = OpTypeInt 32 0 | ||
%ptr = OpTypePointer CrossWorkgroup %i32 | ||
%fnTy = OpTypeFunction %void %ptr %ptr | ||
%mbo = OpConstant %i32 24 | ||
%spec = OpSpecConstantOp %i32 IAdd %mbo %mbo | ||
|
||
%fn = OpFunction %void None %fnTy | ||
%p = OpFunctionParameter %ptr | ||
%q = OpFunctionParameter %ptr | ||
%entry = OpLabel | ||
|
||
OpReturn | ||
OpFunctionEnd |