-
Notifications
You must be signed in to change notification settings - Fork 803
[SYCL][XPTI] Enable PI calls notifications with arguments #3973
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 12 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ad32ada
Initial argument handling implementation
alexbatashev 81a134e
A bit refined implementation
alexbatashev 9b6d5a1
improved comment
alexbatashev ae4c35d
Minor cleanup
alexbatashev 0d3a580
more cleanup
alexbatashev a5792a2
more stylistic changes
alexbatashev a283c03
more file headers
alexbatashev 08702b5
clang-format
alexbatashev df846f9
remove unused include
alexbatashev 3603bda
fix build
alexbatashev ab7fba6
More clang-format
alexbatashev cb248c1
Add arguments for function end as well
alexbatashev 3118d0c
get rid of piapiid
alexbatashev 571b6c4
clang-format
alexbatashev 71805c1
more clang-format
alexbatashev 3151a63
address more feedback
alexbatashev 224d802
Merge remote-tracking branch 'upstream/sycl' into xpti_pi_args
alexbatashev 9775db1
make CI a bit happier
alexbatashev 22ded67
more review feedback
alexbatashev 0b6a5bb
why local and remote clang-format do it differently?
alexbatashev 7a3cde1
remove tuple_view
alexbatashev 47ee4c4
more feedback
alexbatashev b236f2c
Merge remote-tracking branch 'upstream/sycl' into xpti_pi_args
alexbatashev 57e287f
use template magic instead of changing pi.def
alexbatashev 2e3321b
clang-format
alexbatashev 0b08a09
slight changes to xpti interfaces
alexbatashev 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| //==---------- pi_api_id.hpp - PI API function IDs -------------------------==// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| /// \file pi_api_id.hpp | ||
| /// This file contains mapping between PI API functions and their IDs. A hash | ||
| /// function is used to generate IDs. The reason for usage of a hash function | ||
| /// instead of raw values of PiApiKind is ABI stability. New functions can be | ||
| /// added to PiApiKind, and there's no reliable way for external XPTI users to | ||
| /// know when to update the values. Hashes are calculated from API function | ||
alexbatashev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// name, so it will remain the same after update to pi.def. | ||
| /// | ||
| /// \ingroup sycl_pi | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <CL/sycl/detail/pi.hpp> | ||
|
|
||
| __SYCL_INLINE_NAMESPACE(cl) { | ||
| namespace sycl { | ||
| namespace detail { | ||
| constexpr uint32_t cxpow(uint32_t Base, uint32_t Pow) { | ||
| uint32_t Res = Base; | ||
| for (uint32_t I = 1; I < Pow; I++) | ||
| Res *= Base; | ||
| return Res; | ||
| } | ||
|
|
||
| /// This is a simple implementation of polynomial rolling hash function. | ||
| /// | ||
| /// The general formula for the hash is Sum(s[i] * p^i) mod m. | ||
| /// Since only English characters are used for PI function names, p = 53 is | ||
| /// chosen. m = 1051 is a fairly big prime number for the task. | ||
| constexpr uint32_t cxhash(const char *Str) { | ||
| constexpr uint32_t p = 53; | ||
| constexpr uint32_t m = 1051; | ||
| uint32_t Hash = 0; | ||
| uint32_t Len = 0; | ||
| while (Str[Len++] != '\0') | ||
| Hash += Str[Len - 1] * cxpow(p, Len - 1); | ||
| return Hash % m; | ||
| } | ||
|
|
||
| template <PiApiKind Api> struct PiApiID {}; | ||
|
|
||
| #define _PI_API(api) \ | ||
| template <> struct PiApiID<PiApiKind::api> { \ | ||
| static constexpr uint32_t id = cxhash(#api); \ | ||
| }; | ||
|
|
||
| #include <CL/sycl/detail/pi.def> | ||
|
|
||
| #undef _PI_API | ||
| } // namespace detail | ||
| } // namespace sycl | ||
| } // __SYCL_INLINE_NAMESPACE(cl) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.