Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add API logging to validation layer #270

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 1 commit into from
Feb 14, 2025
Merged

Conversation

igchor
Copy link
Member

@igchor igchor commented Feb 3, 2025

No description provided.

@igchor igchor force-pushed the api_logging branch 2 times, most recently from b8464f5 to 17d3901 Compare February 4, 2025 01:04
@nrspruit nrspruit requested review from Jemale and rwmcguir February 4, 2025 19:52
@igchor igchor force-pushed the api_logging branch 2 times, most recently from c5faf17 to 5fddbd5 Compare February 4, 2025 21:38
@igchor igchor marked this pull request as ready for review February 5, 2025 17:05
@igchor igchor force-pushed the api_logging branch 2 times, most recently from 4b451dd to 33d7d92 Compare February 6, 2025 19:19
@igchor
Copy link
Member Author

igchor commented Feb 7, 2025

My PR changing the expected log format in SYCL has been approved so it's seems that we don't have to add any alternative formats - we can just always use the same formatting as loader is using.

intel/llvm#16897


`ZE_ENABLE_VALIDATION_LAYER=1`

By default logs will be written to the log file, as described above. To print the logs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though not incorrect in this review, we may need to update the filename above at line 56 as it appears no longer valid according to current behavior. This may be a good time to update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they incorrect? From what I see, we still have LOADER_LOG_FILE_DIRECTORY defined as ".oneapi_logs" and LOADER_LOG_FILE as "ze_loader.log"

@@ -2411,15 +2528,17 @@ namespace validation_layer
zes_fan_handle_t hFan ///< [in] Handle for the component.
)
{
context.logger->log_trace("zesFanSetDefaultMode(hFan)");
Copy link
Contributor

@rwmcguir rwmcguir Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we log APIs, should we show the hFan value itself? Instead of just the API signature?
This same question could be applied to many of these APIs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do this quite easily for numeric values and perhaps for pointers (although printing the raw address might not be very useful). ze_tracer does this and even handles descriptors (prints all members of a struct in user-readable format) but this requires some extra logic.

We can think about porting (some of) this more complex logic from ze_tracer in future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets take this proposal to a future PR.

namespace loader {

std::string to_string(const ze_result_t result) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can stringify this with MACROs as opposed to keeping another list we have to maintain? Else we have to modify two locations with potential mismatch with new ERROR codes introduced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the other place where we have a list like this?

I'm not sure if macro would help much but we could probably generate this funtion from a .mako file.

Anyway, I would prefer to do that in a separate PR, I did not introduce this function - I just moved it from ze_loader.cpp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets take this proposal to a future PR.

through validation layer when 'trace' level is set.

This will enable us to remove logging L0 calls from UR and make
sure that all L0 calls are being logged (e.g. ones from UMF).

Signed-off-by: Igor Chorazewicz <[email protected]>
@nrspruit nrspruit merged commit 4f42647 into oneapi-src:master Feb 14, 2025
26 checks passed
igchor added a commit to igchor/level-zero that referenced this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants