KhronosGroup / KhronosGroup/OpenCL-CTS

Use types with guaranteed bit width when accessing cl_ types

Open
#1,526 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
232
Forks
235
Avg merge
8d 7h
Merged PRs (30d)
18

Description

https://github.com/KhronosGroup/OpenCL-CTS/pull/1522#issuecomment-1268627109 highlighted a problem with the use of types that do not have a guaranteed bit width across all platforms. Examples identified there were the use of `int` to access `float` data, and `long long` to access `double` data.

There are about 80 occurrences of e.g. `long long` across the current code base. Not all of them are problematic, but some of them could be. For example:
```
test_conformance/conversions/test_conversions.cpp: vlog( "Input value: 0x%16.16llx ", ((unsigned long long*)gIn)[error - 1] );
test_conformance/pipes/test_pipe_read_write.cpp: int *inptr = (int *)ptr1;
```

A solution could be to use corresponding `cl_` types, or ``'s `(u)intN_t` types, which all have a guaranteed bit width.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the examples in test_conformance/conversions/test_conversions.cpp and test_conformance/pipes/test_pipe_read_write.cpp, then audit the roughly 80 long long occurrences across the codebase. Check which accesses depend on platform-dependent widths and replace those with guaranteed-width cl_ or types. Done means the problematic accesses use guaranteed-width types and the relevant conformance tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.