ispc / ispc/ispc

Short uniform vector real size

Open
#3,106 11 comments 0 reactions 1 assignee Claimed by @pbrubaker View on GitHub
Frontend / Parser
Dominant language
C++
Stars
3k
Forks
352
PR merge metrics
No merged PRs in 30d

Description

It looks like the short vector size is actually rounded up to the next power of 2. It is probably done for small sizes due to some performance concerns (e.g., 3 to 4), despite the fact that it is error prone (easy to write an out-of-bound read/write). If short vector has bigger size then it also rounded up. For the example below (https://godbolt.org/z/1P7TE961o), the real size if 512 instead of expected 400.

```ispc
uniform int foo() {
return sizeof(uniform float<100>);
}
```

```asm
foo___: # @foo___
mov eax, 512
ret
```

Rounding is implemented here https://github.com/ispc/ispc/blob/80dccf9c2ff614cb5e144250757e80b1d2263f3e/src/type.cpp#L1992-L2004

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.