intel / intel/llvm

Exploit SPIRV target transform information for SPIR triple.

Open
#7,670 3 comments 0 reactions 0 assignees View on GitHub
compiler confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

> I found it odd that we need to add a 'Targets' folder in Basic when no other Target seems to require this.

Other targets have this value pulled from the backend via the `TargetTransformInfo` (which is what I suggested to use), for instance the definition for [AMDGCN](https://github.com/intel/llvm/blob/sycl/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h#L170).

> but today we target spir triple, which has no TTI. Once SPIR-V backend is matured enough to support SYCL, we can remove the duplication and use

I'm not suggesting to use the SPIR-V backend as a mean to produce the SPIR-V IR. And the driver won't do that anyway. It is just a case to build the SPIR-V backend so we can make use of target info, features etc.

SPIR could be added as one of the SPIR-V target (from dpc++, this is just a triple really). I know upstream has reservations, but as there is no other target that uses this triple, I don't really see the harm as SPIR is supposed to be used in conjunction with `-emit-llvm` (again, I'm not suggesting to use the backend to produce anything, just pull data and control generic transformations). We can also emit a warning / error if someone tries to emit SPIR-V using the backend with the SPIR triple if we are worried ppl start to use it as a "normal path".

I have other use cases where this would be extremely useful to do this but I'll stop here as I'm diverging way too much, probably best for an offline discussion.

_Originally posted by @Naghasan in https://github.com/intel/llvm/pull/7418#discussion_r1027866875_

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.