-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL][ESIMD] Implement IR pass to lower C++ ESIMD intrinsics. #1881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
26e493f
Add workaround for MSVC++ 2017 bug to ItaniumDemangle.h.
kbobrovs c597276
[SYCL][ESIMD] Implement IR pass to lower C++ ESIMD intrinsics.
kbobrovs ba89a49
[SQUASH] Address review comments.
kbobrovs 32584d8
Apply suggestions from code review
kbobrovs f22c5cd
[SQUASH] Fixes after code review comments implementation.
kbobrovs 6c0a911
[SYCL][ESIMD] Move vc-intrinsics dependency build to llvm/lib/SYCLLow…
kbobrovs 24f099f
[SQUASH] Applied clang-format.
kbobrovs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//===---- LowerESIMD.h - lower Explicit SIMD (ESIMD) constructs -----------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Lowers CM-specific LLVM IR constructs coming out of the front-end. These are: | ||
// - ESIMD intrinsics, e.g.: | ||
// template <typename Ty, int N, int M, int VStride, int Width, | ||
// int Stride, int ParentWidth = 0> | ||
// sycl::intel::gpu::vector_type_t<Ty, M> | ||
// __esimd_rdregion(sycl::intel::gpu::vector_type_t<Ty, N> Input, | ||
// uint16_t Offset); | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_SYCLLOWERIR_LOWERESIMD_H | ||
#define LLVM_SYCLLOWERIR_LOWERESIMD_H | ||
|
||
#include "llvm/IR/Function.h" | ||
#include "llvm/IR/PassManager.h" | ||
|
||
namespace llvm { | ||
|
||
/// SPIRV (ESIMD) target specific pass to transform ESIMD specific constructs | ||
/// like intrinsics to a form parsable by the ESIMD-aware SPIRV translator. | ||
class SYCLLowerESIMDPass : public PassInfoMixin<SYCLLowerESIMDPass> { | ||
public: | ||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &, | ||
SmallPtrSet<Type *, 4> &GVTS); | ||
}; | ||
|
||
FunctionPass *createSYCLLowerESIMDPass(); | ||
void initializeSYCLLowerESIMDLegacyPassPass(PassRegistry &); | ||
|
||
} // namespace llvm | ||
|
||
#endif // LLVM_SYCLLOWERIR_LOWERESIMD_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,54 @@ | ||
# Lowering of SYCL ESIMD kernels depends on vc-intrinsics | ||
# NOTE: could have been added earlier from llvm/projects | ||
if (NOT TARGET LLVMGenXIntrinsics) | ||
if (NOT DEFINED LLVMGenXIntrinsics_SOURCE_DIR) | ||
message(STATUS "vc-intrinsics are missing. Will try to download them from github.com") | ||
|
||
include(FetchContent) | ||
FetchContent_Declare(vc-intrinsics | ||
GIT_REPOSITORY https://github.com/intel/vc-intrinsics.git | ||
GIT_TAG cce6e48c28eb850d7dadd30841c0d95f009bbca1 | ||
) | ||
FetchContent_MakeAvailable(vc-intrinsics) | ||
FetchContent_GetProperties(vc-intrinsics) | ||
|
||
set(LLVMGenXIntrinsics_SOURCE_DIR ${vc-intrinsics_SOURCE_DIR}) | ||
set(LLVMGenXIntrinsics_BINARY_DIR ${vc-intrinsics_BINARY_DIR}) | ||
else() | ||
# -DLLVMGenXIntrinsics_SOURCE_DIR is provided | ||
message(STATUS "vc-intrinsics are added manually ${LLVMGenXIntrinsics_SOURCE_DIR}") | ||
|
||
set(LLVMGenXIntrinsics_BINARY_DIR ${CMAKE_BINARY_DIR}/vc-intrinsics-build) | ||
add_subdirectory(${LLVMGenXIntrinsics_SOURCE_DIR} ${LLVMGenXIntrinsics_BINARY_DIR}) | ||
endif() | ||
|
||
target_include_directories(LLVMGenXIntrinsics | ||
PUBLIC $<BUILD_INTERFACE:${LLVMGenXIntrinsics_SOURCE_DIR}/GenXIntrinsics/include> | ||
PUBLIC $<BUILD_INTERFACE:${LLVMGenXIntrinsics_BINARY_DIR}/GenXIntrinsics/include> | ||
) | ||
endif() | ||
|
||
add_llvm_component_library(LLVMSYCLLowerIR | ||
LowerWGScope.cpp | ||
LowerESIMD.cpp | ||
|
||
ADDITIONAL_HEADER_DIRS | ||
${LLVM_MAIN_INCLUDE_DIR}/llvm/SYCLLowerIR | ||
${LLVM_MAIN_SRC_DIR}/projects/vc-intrinsics/GenXIntrinsics/include | ||
${LLVM_BINARY_DIR}/projects/vc-intrinsics/GenXIntrinsics/include | ||
|
||
DEPENDS | ||
intrinsics_gen | ||
LLVMGenXIntrinsics | ||
LLVMDemangle | ||
LLVMTransformUtils | ||
|
||
LINK_LIBS | ||
LLVMGenXIntrinsics | ||
LLVMDemangle | ||
LLVMTransformUtils | ||
) | ||
|
||
target_include_directories(LLVMSYCLLowerIR | ||
PRIVATE ${LLVM_MAIN_SRC_DIR}/projects/vc-intrinsics/GenXIntrinsics/include | ||
PRIVATE ${LLVM_BINARY_DIR}/projects/vc-intrinsics/GenXIntrinsics/include) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... is this a GitHub bug or this code will be added again?
It should be already in place - #2021.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to make compilation and testing for this PR pass. I will rebase and this will go away.