-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SPV_INTEL_cache_controls #2140
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
; RUN: llvm-as %s -o %t.bc | ||
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV | ||
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls %t.bc -o %t.spv | ||
; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
|
||
; CHECK-SPIRV-DAG: Load {{[0-9]+}} {{[0-9]+}} [[LoadPtr:[0-9]+]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We kinda decorate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary. We know that Load's 2nd parameter is 'OpTypePointer' type and we want to make sure that it's properly decorated. It doesn't matter from what instruction the pointer comes from. |
||
; CHECK-SPIRV-DAG: Store [[StorePtr:[0-9]+]] | ||
|
||
; CHECK-SPIRV-DAG: Decorate [[LoadPtr]] CacheControlLoadINTEL 0 1 | ||
; CHECK-SPIRV-DAG: Decorate [[LoadPtr]] CacheControlLoadINTEL 1 1 | ||
; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 0 1 | ||
; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 1 2 | ||
|
||
; CHECK-LLVM: %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 1, !spirv.Decorations [[LoadMD:![0-9]+]] | ||
; CHECK-LLVM: load i32, ptr addrspace(1) %arrayidx, align 4 | ||
|
||
; CHECK-LLVM: %arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 0, !spirv.Decorations [[StoreMD:![0-9]+]] | ||
; CHECK-LLVM: store i32 %0, ptr addrspace(1) %arrayidx1, align 4 | ||
|
||
; CHECK-LLVM: [[LoadMD]] = !{[[CC0:![0-9]+]], [[CC1:![0-9]+]]} | ||
; CHECK-LLVM: [[CC0]] = !{i32 6442, i32 0, i32 1} | ||
; CHECK-LLVM: [[CC1]] = !{i32 6442, i32 1, i32 1} | ||
|
||
; CHECK-LLVM: [[StoreMD]] = !{[[CC2:![0-9]+]], [[CC3:![0-9]+]]} | ||
; CHECK-LLVM: [[CC2]] = !{i32 6443, i32 0, i32 1} | ||
; CHECK-LLVM: [[CC3]] = !{i32 6443, i32 1, i32 2} | ||
|
||
target triple = "spir64-unknown-unknown" | ||
|
||
define spir_kernel void @test(ptr addrspace(1) %buffer) { | ||
entry: | ||
%arrayidx = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 1, !spirv.Decorations !3 | ||
%0 = load i32, ptr addrspace(1) %arrayidx, align 4 | ||
%arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 0, !spirv.Decorations !6 | ||
store i32 %0, ptr addrspace(1) %arrayidx1, align 4 | ||
ret void | ||
} | ||
|
||
!spirv.MemoryModel = !{!0} | ||
!spirv.Source = !{!1} | ||
!opencl.spir.version = !{!2} | ||
!opencl.ocl.version = !{!2} | ||
|
||
!0 = !{i32 2, i32 2} | ||
!1 = !{i32 3, i32 102000} | ||
!2 = !{i32 1, i32 2} | ||
!3 = !{!4, !5} | ||
!4 = !{i32 6442, i32 0, i32 1} ; {CacheControlLoadINTEL, CacheLevel=0, Cached} | ||
!5 = !{i32 6442, i32 1, i32 1} ; {CacheControlLoadINTEL, CacheLevel=1, Cached} | ||
!6 = !{!7, !8} | ||
!7 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} | ||
!8 = !{i32 6443, i32 1, i32 2} ; {CacheControlStoreINTEL, CacheLevel=1, WriteBack} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; RUN: llvm-as %s -o %t.bc | ||
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV | ||
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls %t.bc -o %t.spv | ||
; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
|
||
; CHECK-SPIRV-DAG: Store [[StorePtr:[0-9]+]] | ||
|
||
; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 0 1 | ||
; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 1 3 | ||
|
||
; CHECK-LLVM: @p = common addrspace(1) global i32 0, align 4, !spirv.Decorations [[GlobalMD:![0-9]+]] | ||
; CHECK-LLVM: store i32 0, ptr addrspace(1) @p, align 4 | ||
|
||
; CHECK-LLVM-DAG: [[CC0:![0-9]+]] = !{i32 6443, i32 0, i32 1} | ||
; CHECK-LLVM-DAG: [[CC1:![0-9]+]] = !{i32 6443, i32 1, i32 3} | ||
; CHECK-LLVM-DAG: [[GlobalMD]] = {{.*}}[[CC0]]{{.*}}[[CC1]] | ||
|
||
target triple = "spir64-unknown-unknown" | ||
|
||
@p = common addrspace(1) global i32 0, align 4, !spirv.Decorations !3 | ||
|
||
define spir_kernel void @test() { | ||
entry: | ||
store i32 0, i32 addrspace(1)* @p, align 4 | ||
ret void | ||
} | ||
|
||
!spirv.MemoryModel = !{!0} | ||
!spirv.Source = !{!1} | ||
!opencl.spir.version = !{!2} | ||
!opencl.ocl.version = !{!2} | ||
|
||
!0 = !{i32 2, i32 2} | ||
!1 = !{i32 3, i32 102000} | ||
!2 = !{i32 1, i32 2} | ||
!3 = !{!4, !5} | ||
!4 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} | ||
!5 = !{i32 6443, i32 1, i32 3} ; {CacheControlStoreINTEL, CacheLevel=1, Streaming} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the spec is public, please move these definitions to https://github.com/KhronosGroup/SPIRV-Headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created PR for SPIRV-Headers: KhronosGroup/SPIRV-Headers#376