Comments (6)
SPIRV 1.4 added OpPtrEqual and OpPtrNotEqual in order to let us compare pointers, but maybe it would be too harsh to require 1.4?
Otherwise in order to fix that we would have to cast pointers to unsigned integers and compare these.
from spirv-llvm-translator.
+1, I've hit a similar problem. Here's a module to reproduce:
source_filename = "repro.cl"
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir64-unknown-unknown"
define spir_kernel void @test(i8 addrspace(1)* %aptr, i8 addrspace(1)* %bptr) local_unnamed_addr #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
entry:
%cmp213 = icmp ugt i8 addrspace(1)* %aptr, %bptr
ret void
}
attributes #0 = { "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable }
!llvm.ident = !{!0}
!0 = !{!"clang version 9.0.0 "}
!1 = !{i32 1, i32 1}
!2 = !{!"none", !"none"}
!3 = !{!"uchar*", !"uchar*"}
!4 = !{!"", !""}
The SPIR-V produced is
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 13
; Schema: 0
OpCapability Addresses
OpCapability Kernel
OpCapability Int8
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %6 "test"
%12 = OpString "kernel_arg_type.test.uchar*,uchar*,"
OpSource Unknown 0
OpName %aptr "aptr"
OpName %bptr "bptr"
OpName %entry "entry"
OpName %cmp213 "cmp213"
%uchar = OpTypeInt 8 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar %_ptr_CrossWorkgroup_uchar
%bool = OpTypeBool
%6 = OpFunction %void None %5
%aptr = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%bptr = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%entry = OpLabel
%cmp213 = OpUGreaterThan %bool %aptr %bptr
OpReturn
OpFunctionEnd
which fails validation
error: line 22: Expected operands to be scalar or vector int: UGreaterThan
%cmp213 = OpUGreaterThan %bool %aptr %bptr
from spirv-llvm-translator.
@karolherbst We do need a solution pre-1.4. It seems that converting to integers is the only way. FWIW, the LLVM language reference manual states
If the operands are pointer typed, the pointer values are compared as if they were integers.
from spirv-llvm-translator.
yeah, I think converting to integers pre 1.4 is valid, I would just support both ways. And I think there is already the assumption that the consumer always has to be able to support the most recent spirv version...
might be worth to kind of being able to tell what's the highest version the consumer supports and then disabling certain features or something.
from spirv-llvm-translator.
And I think there is already the assumption that the consumer always has to be able to support the most recent spirv version...
Really? For example, intel/compute-runtime supports only SPIR-V 1.2
might be worth to kind of being able to tell what's the highest version the consumer supports and then disabling certain features or something.
I think we definitely need this, see #110 for appropriate discussion.
from spirv-llvm-translator.
And I think there is already the assumption that the consumer always has to be able to support the most recent spirv version...
Really? For example, intel/compute-runtime supports only SPIR-V 1.2
oh, could be that I am wrong. I think some future spir-v feature was enabled without the extension... would have to search for it again.
from spirv-llvm-translator.
Related Issues (20)
- Missing SPIR-V 1.4 features/changes HOT 3
- llvm-as does not verify LLVM output from SPIR-V to LLVM translation (Overlapping tbaa.struct regions) HOT 2
- Indicies in SpecConstantOp PtrAccessChain of global variales are not adjusted for their actual type.
- Both GetElementPtrConstantExpr and GetElementPtrInst may represent access to a buildin variable HOT 1
- `ID '19' decorated with NoSignedWrap multiple times is not allowed.` HOT 1
- Translator incapable to generate TypeStruct EntryPoint parameters
- User defined/declared functions are wrongly identified as OpenCL builtins HOT 1
- Invalid OpenCL version and non-cpp source language lead to crash while generating device-dependent OpenCL binaries from a valid SPIR-V input HOT 9
- InvalidInstruction: Can't translate llvm instruction with LLVM 18 (working with 17) HOT 8
- spt file containing GlobalVariableHostAccessINTEL changes after -to-binary and then -to-text
- Drop llvm.compiler.used GV? HOT 1
- Add SPIR-V backend - SPIR-V Translator cross validation HOT 4
- SPV_EXT_relaxed_printf_string_address_space allows format from too many address spaces
- How to build LLVMSPIRVLib as a shared library on Windows? HOT 2
- Image validation in unit test
- Two days tyring to figure this out. HOT 2
- Ability to use system version of SPIRV-Headers without specifying source directory.
- Missing dimidx checks when translating get_global_offset HOT 2
- InvalidFunctionCall: Unexpected llvm intrinsic: `llvm.fabs.bf16` HOT 2
- handling UserSemantic decoration on Input variables HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spirv-llvm-translator.