KhronosGroup / KhronosGroup/SPIR

Should it be possible to use long long?

Open
#58 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
183
Forks
51
PR merge metrics
No merged PRs in 30d

Description

File [test/libclcxx/pipes/TestBasicPipeStructData.cl](https://github.com/KhronosGroup/libclcxx/blob/master/test/libclcxx/pipes/TestBasicPipeStructData.cl) (OpenCL 2.2 C++) from [libclcxx](https://github.com/KhronosGroup/libclcxx) tests contains a structure which contains a `long long` member. If you compile that file as describled in [the readme](https://github.com/KhronosGroup/SPIR/tree/spirv-1.1#step-6-creating-spir-v-binaries) there are no errors. If later you translate binary `.spir` file to text SPIR-V .spt file (using `llvm-spirv` or `spirv-dis`), it turns out that there is a `TypeInt 128 0` SPIR-V instruction, which defines a 128-bit integer.

That means that not only OpenCL C++ compiler accepted `long long` type, which is not defined in OpenCL C++ spec (however, `long long` is a reserved for future use), but also compiled it to 128-bit integer (I would somehow understand if it compiles `long long` to 64-bit integer`).

```cpp
// in .cl file:
struct structType
{
float a;
int b;
long long c;
};

// in .spt file:
4 TypeInt 128 0
```

Is it correct behaviour? Because I would expect a compilation error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with test/libclcxx/pipes/TestBasicPipeStructData.cl and the compilation steps in the linked README. Reproduce the generated TypeInt 128 using llvm-spirv or spirv-dis, then compare the accepted long long type with the OpenCL C++ and SPIR-V specifications. Done means determining whether compilation should reject the type or emit a different integer width, with the expected behavior documented for maintainers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.