-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Implement host pipe unique name generation and mapping calls #8009
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
14 commits
Select commit
Hold shift + click to select a range
823985f
Implement host pipe unique name generation and mapping calls
rho180 c905dcd
Add front end lit tests for host pipes
rho180 e62716f
Update driver lit tests to include sycl-post-link host-pipes argument
rho180 dc84cb9
Remove spurious XFAIL from host_pipe lit test
rho180 c2f11e0
Use sycl_type to denote host pipes instead of new attribute
rho180 20e3d80
Remove check for HostPipe attribute in attribute list test
rho180 e8845cc
Simplify host_pipe attribute checking
rho180 d0fe353
Remove unnecessary lit test args for host_pipe test
rho180 7b828d7
Remove another unnecessary arg for host_pipe test
rho180 e34ac9e
Move host pipe compile time properties processing to opt
rho180 9e28e16
Remove -host-pipes arg from clang driver tests
rho180 aad8b8c
Cleanup unnecessary include and class declarations in HostPipes header
rho180 dacaed3
Move HostPipes check function to SYCLUtils; remove extraneous sycl-po…
rho180 82a1efa
Update llvm/include/llvm/SYCLLowerIR/SYCLUtils.h
rho180 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
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,27 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown-sycldevice -fsycl-unique-prefix=THE_PREFIX -opaque-pointers -emit-llvm %s -o - | FileCheck %s | ||
#include "sycl.hpp" | ||
|
||
// Test cases below show that 'sycl-unique-id' LLVM IR attribute is attached to the | ||
// global variable whose type is decorated with host_pipe attribute, and that a | ||
// unique string is generated. | ||
|
||
using namespace sycl::ext::intel::experimental; | ||
using namespace sycl; | ||
queue q; | ||
|
||
// check that "sycl-unique-id" attribute is created for host pipes | ||
// CHECK: @_ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE5HPIntiE6__pipeE = internal addrspace(1) constant %"struct.sycl::_V1::ext::intel::experimental::host_pipe<HPInt, int>::__pipeType" zeroinitializer, align 1 #[[HPINT_ATTRS:[0-9]+]] | ||
// CHECK: @_ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE7HPFloatiE6__pipeE = internal addrspace(1) constant %"struct.sycl::_V1::ext::intel::experimental::host_pipe<HPFloat, int>::__pipeType" zeroinitializer, align 1 #[[HPFLOAT_ATTRS:[0-9]+]] | ||
|
||
void foo() { | ||
q.submit([&](handler &h) { | ||
h.single_task<class kernel_name_1>([=]() { | ||
host_pipe<class HPInt, int>::read(); | ||
host_pipe<class HPFloat, int>::read(); | ||
}); | ||
}); | ||
} | ||
|
||
// CHECK: attributes #[[HPINT_ATTRS]] = { "sycl-unique-id"="THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE5HPIntiE6__pipeE" } | ||
// CHECK: attributes #[[HPFLOAT_ATTRS]] = { "sycl-unique-id"="THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE7HPFloatiE6__pipeE" | ||
|
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,48 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown -fsycl-int-footer=%t.footer.h -fsycl-int-header=%t.header.h -fsycl-unique-prefix=THE_PREFIX %s -emit-llvm -o %t.ll | ||
// RUN: FileCheck -input-file=%t.footer.h %s --check-prefix=CHECK-FOOTER | ||
// RUN: FileCheck -input-file=%t.header.h %s --check-prefix=CHECK-HEADER | ||
#include "sycl.hpp" | ||
|
||
// Test cases below show that 'sycl-unique-id' LLVM IR attribute is attached to the | ||
// global variable whose type is decorated with host_pipe attribute, and that a | ||
// unique string is generated. | ||
|
||
using namespace sycl::ext::intel::experimental; | ||
using namespace sycl; | ||
queue q; | ||
|
||
void foo() { | ||
q.submit([&](handler &h) { | ||
h.single_task<class kernel_name_1>([=]() { | ||
host_pipe<class HPInt, int>::read(); | ||
host_pipe<class HPFloat, int>::read(); | ||
}); | ||
}); | ||
} | ||
|
||
// CHECK-HEADER: namespace sycl { | ||
// CHECK-HEADER-NEXT: __SYCL_INLINE_VER_NAMESPACE(_V1) { | ||
// CHECK-HEADER-NEXT: namespace detail { | ||
// CHECK-HEADER-NEXT: namespace { | ||
// CHECK-HEADER-NEXT: class __sycl_host_pipe_registration { | ||
// CHECK-HEADER-NEXT: public: | ||
// CHECK-HEADER-NEXT: __sycl_host_pipe_registration() noexcept; | ||
// CHECK-HEADER-NEXT: }; | ||
// CHECK-HEADER-NEXT: __sycl_host_pipe_registration __sycl_host_pipe_registrar; | ||
// CHECK-HEADER-NEXT: } // namespace | ||
// CHECK-HEADER: } // namespace detail | ||
// CHECK-HEADER: } // __SYCL_INLINE_VER_NAMESPACE(_V1) | ||
// CHECK-HEADER: } // namespace sycl | ||
|
||
// CHECK-FOOTER: #include <sycl/detail/defines_elementary.hpp> | ||
// CHECK-FOOTER: #include <sycl/detail/host_pipe_map.hpp> | ||
// CHECK-FOOTER-NEXT: namespace sycl::detail { | ||
// CHECK-FOOTER-NEXT: namespace { | ||
// CHECK-FOOTER-NEXT: __sycl_host_pipe_registration::__sycl_host_pipe_registration() noexcept { | ||
|
||
// CHECK-FOOTER: host_pipe_map::add((void *)&::sycl::ext::intel::experimental::host_pipe<HPInt, int>::__pipe, "THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE5HPIntiE6__pipeE"); | ||
// CHECK-FOOTER: host_pipe_map::add((void *)&::sycl::ext::intel::experimental::host_pipe<HPFloat, int>::__pipe, "THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE7HPFloatiE6__pipeE"); | ||
|
||
// CHECK-FOOTER: } // namespace (unnamed) | ||
// CHECK-FOOTER: } // namespace sycl::detail | ||
|
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
21 changes: 21 additions & 0 deletions
21
llvm/test/SYCLLowerIR/CompileTimePropertiesPass/host-pipes/basic.ll
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,21 @@ | ||
; RUN: opt -passes=compile-time-properties %s -S | FileCheck %s --check-prefix CHECK-IR | ||
|
||
; This test is intended to check that CompileTimePropertiesPass adds all the required | ||
; metadata nodes to host pipe vars decorated with the "sycl-host-pipe" attribute | ||
|
||
source_filename = "basic.cpp" | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" | ||
target triple = "spir64_fpga-unknown-unknown" | ||
|
||
%struct.BasicKernel = type { i8 } | ||
|
||
$_ZN4sycl3_V13ext5intel12experimental9host_pipeI9D2HPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE = comdat any | ||
|
||
@_ZN4sycl3_V13ext5intel12experimental9host_pipeI9D2HPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE = linkonce_odr dso_local addrspace(1) constant %struct.BasicKernel zeroinitializer, comdat, align 1 #0 | ||
; CHECK-IR: @_ZN4sycl3_V13ext5intel12experimental9host_pipeI9D2HPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE = linkonce_odr dso_local addrspace(1) constant %struct.BasicKernel zeroinitializer, comdat, align 1, !spirv.Decorations ![[#MN0:]] | ||
|
||
attributes #0 = { "sycl-host-pipe" "sycl-unique-id"="_ZN4sycl3_V13ext5intel12experimental9host_pipeI9H2DPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE" } | ||
|
||
; Ensure that the generated metadata nodes are correct | ||
; CHECK-IR-DAG: ![[#MN0]] = !{![[#MN1:]]} | ||
; CHECK-IR-DAG: ![[#MN1]] = !{i32 6147, i32 2, !"_ZN4sycl3_V13ext5intel12experimental9host_pipeI9H2DPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE"} |
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,21 @@ | ||
//==-------------------- host_pipe_map.hpp -----------------------------==// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
namespace sycl { | ||
__SYCL_INLINE_VER_NAMESPACE(_V1) { | ||
namespace detail { | ||
namespace host_pipe_map { | ||
|
||
__SYCL_EXPORT void add(const void *HostPipePtr, const char *UniqueId); | ||
|
||
} // namespace host_pipe_map | ||
} // namespace detail | ||
} // __SYCL_INLINE_VER_NAMESPACE(_V1) | ||
} // namespace sycl |
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.
Uh oh!
There was an error while loading. Please reload this page.