-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport to 17] [SPIR-V 1.2] SPIRVReader: Add AlignmentId support (#…
…2869) (#2888) If there is no `OpDecorate .. Alignment` in the input, see if there is an `OpDecorateId .. AlignmentId` and take the alignment from the referenced constant instead. Once `AlignmentId` has been translated to LLVM IR, it is indistinguishable from an (non-ID) `Alignment` decoration. (cherry picked from commit da1731b)
- Loading branch information
Showing
3 changed files
with
73 additions
and
11 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
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,34 @@ | ||
; 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 | ||
|
||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %fn "testAlignmentId" | ||
OpName %p "p" | ||
OpDecorate %x LinkageAttributes "x" Export | ||
OpDecorateId %x AlignmentId %al | ||
OpDecorateId %p AlignmentId %al_spec | ||
%void = OpTypeVoid | ||
%uint = OpTypeInt 32 0 | ||
%ptr = OpTypePointer CrossWorkgroup %uint | ||
%fnTy = OpTypeFunction %void %ptr | ||
%al = OpConstant %uint 16 | ||
%al_spec = OpSpecConstantOp %uint IAdd %al %al | ||
%uint_42 = OpConstant %uint 42 | ||
; Verify alignment of variable. | ||
; CHECK: @x = addrspace(1) global i32 42, align 16 | ||
%x = OpVariable %ptr CrossWorkgroup %uint_42 | ||
|
||
%fn = OpFunction %void None %fnTy | ||
; Verify alignment of function parameter. | ||
; CHECK: define spir_kernel void @testAlignmentId(ptr addrspace(1) align 32 %p) | ||
%p = OpFunctionParameter %ptr | ||
%entry = OpLabel | ||
OpReturn | ||
OpFunctionEnd |