[PATCH] D109818: [HIPSPV] Convert HIP kernels to SPIR-V kernels

Henry Linjamäki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 20 02:20:05 PDT 2021


linjamaki created this revision.
Herald added subscribers: Anastasia, yaxunl.
linjamaki updated this revision to Diff 372671.
linjamaki added a comment.
Herald added subscribers: dexonsmith, hiraditya.
linjamaki updated this revision to Diff 373494.
linjamaki edited the summary of this revision.
linjamaki published this revision for review.
linjamaki added reviewers: Anastasia, bader.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Rebase.


linjamaki added a comment.

Rebase.


This patch translates HIP kernels to SPIR-V kernels when the HIP 
compilation mode is targeting SPIR-S. This involves:

- Setting Cuda calling convention to CC_OpenCLKernel (which maps to SPIR_KERNEL in LLVM IR later on).

- Coercing pointer arguments with default address space (AS) qualifier to CrossWorkGroup AS (__global in OpenCL). HIPSPV's device code is ultimately SPIR-V for OpenCL execution environment (as starter/default) where Generic or Function (OpenCL's private) is not supported as storage class for kernel pointer types. This leaves the CrossWorkGroup to be the only reasonable choice for HIP buffers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109818

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGenHIP/hipspv-kernel.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109818.373494.patch
Type: text/x-patch
Size: 3600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210920/97bc08a8/attachment.bin>


More information about the cfe-commits mailing list