-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Implement tracing for in-memory kernel and program cache #15925
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
sommerlukas
merged 6 commits into
intel:sycl
from
uditagarwal97:enable_in_mem_cache_trace
Nov 1, 2024
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
479854d
Add tracing for in-memory cache
uditagarwal97 a6a316c
Inline trace functionms
uditagarwal97 2718afb
Implement tracing in in-memory kernel and program cache.
uditagarwal97 d1732b4
Address feedback
uditagarwal97 662eec3
Fix formatting
uditagarwal97 4272cf1
Address reviews
uditagarwal97 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
61 changes: 61 additions & 0 deletions
61
sycl/test-e2e/KernelAndProgram/trace_kernel_program_cache.cpp
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,61 @@ | ||
| // Tests tracing of in-memory kernel and program cache. | ||
|
|
||
| // RUN: %{build} -o %t.out | ||
|
|
||
| // There should be no tracing output when SYCL_CACHE_IN_MEM is not set | ||
| // or SYCL_CACHE_TRACE is set to 0. | ||
|
|
||
| // RUN: env SYCL_CACHE_IN_MEM=0 %{run} %t.out \ | ||
| // RUN: | FileCheck --allow-empty --check-prefix=CHECK-NO-TRACE %s | ||
| // RUN: env SYCL_CACHE_TRACE=0 %{run} %t.out \ | ||
| // RUN: | FileCheck --allow-empty --check-prefix=CHECK-NO-TRACE %s | ||
|
|
||
| // CHECK-NO-TRACE-NOT: [In-Memory Cache]{{.*}} | ||
uditagarwal97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // RUN: env SYCL_CACHE_TRACE=2 %{run} %t.out 2> %t.trace | ||
| // RUN: FileCheck %s --input-file=%t.trace --check-prefix=CHECK-CACHE-TRACE | ||
uditagarwal97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #include <sycl/detail/core.hpp> | ||
|
|
||
| #include <sycl/specialization_id.hpp> | ||
| #include <sycl/usm.hpp> | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| constexpr specialization_id<int> spec_id; | ||
|
|
||
| int main() { | ||
| queue q; | ||
|
|
||
| // Check program insertion into cache and kernel insertion into fast and | ||
| // regular kernel cache. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Program Cache][Key:{{.*}}]: Program inserted. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 0][Key:{Name = [[KERNELNAME1:.*]]]: Kernel inserted. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 1][Key:{Name = [[KERNELNAME1]]]: Kernel inserted. | ||
|
|
||
| // In the 2nd and 3rd invocation of this loop, the kernel should be fetched | ||
| // from fast kernel cache. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 1][Key:{Name = [[KERNELNAME1]]]: Kernel fetched. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 1][Key:{Name = [[KERNELNAME1]]]: Kernel fetched. | ||
| for (int i = 0; i < 3; i++) | ||
| q.single_task([] {}).wait(); | ||
|
|
||
| auto *p = malloc_device<int>(1, q); | ||
|
|
||
| // Check program and kernel insertion into cache. There should be different | ||
| // programs for different iterations of this loop, because of the different | ||
| // specialization constants. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Program Cache][Key:{{.*}}]: Program inserted. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 0][Key:{Name = [[KERNELNAME2:.*]]]: Kernel inserted. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Program Cache][Key:{{.*}}]: Program inserted. | ||
| // CHECK-CACHE-TRACE: [In-Memory Cache][Thread Id:{{.*}}][Kernel Cache][IsFastCache: 0][Key:{Name = [[KERNELNAME2]]]: Kernel inserted. | ||
| 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); | ||
| } | ||
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.