-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add environment variable to disable in-memory program caching #11751
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
ac621c3
[SYCL] Add environment variable to disable in-memory program caching
jzc 2021871
Add test
jzc 88439ea
clang-format
jzc b1afb68
Add release in graph append and don't use optional with lock guard
jzc 157db1b
clang-format
jzc 0d2f79f
Fix kernel bundle graph append
jzc 8462232
Set EliminatedArgMask
jzc a1c759d
Merge remote-tracking branch 'intel/sycl' into disable-caching
jzc d07e6fa
Address review comments
jzc d2c7123
clang-format
jzc 1eb9b5d
Change environment variable and update test
jzc d0b8610
Merge remote-tracking branch 'intel/sycl' into disable-caching
jzc ac48ff1
Address review comments
jzc 523ec14
Merge remote-tracking branch 'intel/sycl' into disable-caching
jzc 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
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,87 @@ | ||
// This test ensures created program/kernels are not retained | ||
// if and only if caching is disabled. | ||
|
||
// RUN: %{build} -o %t.out | ||
// RUN: env SYCL_PI_TRACE=-1 SYCL_CACHE_IN_MEM=0 %{run} %t.out \ | ||
// RUN: | FileCheck %s | ||
// RUN: env SYCL_PI_TRACE=-1 %{run} %t.out \ | ||
// RUN: | FileCheck %s --check-prefixes=CHECK-CACHE | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
|
||
constexpr specialization_id<int> spec_id; | ||
|
||
int main() { | ||
queue q; | ||
// CHECK: piProgramCreate | ||
// CHECK-NOT: piProgramRetain | ||
// CHECK: piKernelCreate | ||
// CHECK-NOT: piKernelRetain | ||
// CHECK: piEnqueueKernelLaunch | ||
// CHECK: piKernelRelease | ||
// CHECK: piProgramRelease | ||
// CHECK: piEventsWait | ||
|
||
// CHECK-CACHE: piProgramCreate | ||
// CHECK-CACHE: piProgramRetain | ||
// CHECK-CACHE: piKernelCreate | ||
// CHECK-CACHE: piKernelRetain | ||
// CHECK-CACHE: piEnqueueKernelLaunch | ||
// CHECK-CACHE: piKernelRelease | ||
// CHECK-CACHE: piProgramRelease | ||
// CHECK-CACHE: piEventsWait | ||
q.single_task([] {}).wait(); | ||
|
||
// CHECK: piProgramCreate | ||
// CHECK-NOT: piProgramRetain | ||
// CHECK: piKernelCreate | ||
// CHECK-NOT: piKernelRetain | ||
// CHECK: piEnqueueKernelLaunch | ||
// CHECK: piKernelRelease | ||
// CHECK: piProgramRelease | ||
// CHECK: piEventsWait | ||
|
||
// CHECK-CACHE: piProgramCreate | ||
// CHECK-CACHE: piProgramRetain | ||
// CHECK-CACHE: piKernelCreate | ||
// CHECK-CACHE: piKernelRetain | ||
// CHECK-CACHE: piEnqueueKernelLaunch | ||
// CHECK-CACHE: piKernelRelease | ||
// CHECK-CACHE: piProgramRelease | ||
// CHECK-CACHE: piEventsWait | ||
|
||
// CHECK: piProgramCreate | ||
// CHECK-NOT: piProgramRetain | ||
// CHECK: piKernelCreate | ||
// CHECK-NOT: piKernelRetain | ||
// CHECK: piEnqueueKernelLaunch | ||
// CHECK: piKernelRelease | ||
// CHECK: piProgramRelease | ||
// CHECK: piEventsWait | ||
|
||
// CHECK-CACHE: piProgramCreate | ||
// CHECK-CACHE: piProgramRetain | ||
// CHECK-CACHE: piKernelCreate | ||
// CHECK-CACHE: piKernelRetain | ||
// CHECK-CACHE: piEnqueueKernelLaunch | ||
// CHECK-CACHE: piKernelRelease | ||
// CHECK-CACHE: piProgramRelease | ||
// CHECK-CACHE: piEventsWait | ||
auto *p = malloc_shared<int>(1, q); | ||
for (int i = 0; i < 2; ++i) | ||
q.submit([&](handler &cgh) { | ||
cgh.set_specialization_constant<spec_id>(i); | ||
cgh.parallel_for(1, [=](auto, kernel_handler kh) { | ||
*p = kh.get_specialization_constant<spec_id>(); | ||
}); | ||
}).wait(); | ||
|
||
free(p, q); | ||
} | ||
|
||
// (Program cache releases) | ||
// CHECK-CACHE: piKernelRelease | ||
// CHECK-CACHE: piProgramRelease | ||
// CHECK-CACHE: piKernelRelease | ||
// CHECK-CACHE: piProgramRelease |
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
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.
Could this logic be moved to
getOrBuild
to avoid having to do it before each call to it?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.
Yes, but I think it'd probably be better suited for another PR. There are really two types of uses of
getOrBuild
, one with kernels and one with programs. The returns types differ between the two case, so it'd be a little awkward to insert this special logic for the program case in there. Alternatively, one could make agetOrBuildProgram
andgetOrBuildKernel
program and then put that special logic in thegetOrBuildKernel
function, but there would still be a oddity with the return type: when caching, we wrap the value in aBuildResult
and return a pointer to that (owned by the cache), but when are not caching, we bypass theBuildResult
object, and would only want to return the value. This can still be resolved by further modifying thesegetOrBuild
functions to return only the values we extract from theBuildResult
anyways, but I believe this'll most likely create a lot of changes unrelated to the original goal of PR.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.
From what I remember of the code, it is due for a bit of an overhaul anyway. 👍