google / google/clspv

Canonicalization of GEPs to i8

Open
#1,292 10 comments 1 reaction 0 assignees View on GitHub
Dominant language
LLVM
Stars
729
Forks
110
Avg merge
17h 51m
Merged PRs (30d)
23

Description

LLVM now canonicalizes some (constant) GEPs to perform address calculations in terms of bytes. This is part of larger change of moving towards `ptradd` instead of `getelementptr`. This will require changes in clspv to keep pace.

At the moment I'm seeing different failures:
* unit tests with incorrect codegen expectations (~115 per arch)
* cts failures that look functionally incorrect

For example, in `test/CommonBuiltins/min/half2_fmin.cl` the loads are broken down into 4 1-byte loads, a vector creation, and a bitcast from `v4uchar` to `v2half`. This is problematic for a few reasons:
1. Not all devices support byte addressing and clspv now requires it.
2. It relies on downstream drivers to properly coalesce memory accesses. This might be ok, but I don't have performance numbers that are easily accessible one way or the other.
3. It muddies the IR. This isn't *just* an aesthetic concern. There is a binary size increase in these cases due to more instructions getting used.

CTS failures:
* basic/vstore_local (fails char2 and uchar2)
* relationals/shuffle_copy
* relationals/shuffle_function_call
* relationals/shuffle_built_in
* relationals/shuffle_built_in_dual_input
* relationals/shuffle_array_cast

The likely solution is a change in type inference that can find a better type than i8 by looking at the GEP's users (right now it stops at any GEP).

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.