Skip to content
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

Refactor Level Zero Adapter to use new logger #1032

Merged
merged 1 commit into from
Apr 22, 2024
Merged

Conversation

lplewa
Copy link
Contributor

@lplewa lplewa commented Nov 2, 2023

No description provided.

@@ -184,7 +184,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetLastError(
std::ignore = Adapter;
std::ignore = Message;
std::ignore = Error;
urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__);
logger::error("[UR][L0] {} function not implemented!", __FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

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

As the name of the logger is level_zero, the beginning of this logger output will look like that, I think: <level_zero>[ERROR][UR][L0]. No need for double level zero info, I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

WG[0], WG[1], WG[2]);
logger::debug("urCommandBufferAppendKernelLaunchExp: using computed WG "
"size = {{{}, "
"{}, {}}}\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the double newline (one explicit and one aded by the logger) intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -174,7 +175,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter(
std::ignore = Context;
std::ignore = Deleter;
std::ignore = UserData;
urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__);
logger::error("[UR][L0] {} function not implemented!", __FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, test these __FUNCTION__ prints with different compilers, perhaps create a test case for such a print to verify if this works with compilers tested in UR CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you think that it will not work?

@@ -980,7 +981,7 @@ ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal,
if (numQueueGroups == 0) {
return UR_RESULT_ERROR_UNKNOWN;
}
urPrint("NOTE: Number of queue groups = %d\n", numQueueGroups);
logger::error("NOTE: Number of queue groups = {}\n", numQueueGroups);
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra newline, is it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -742,7 +741,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback(
std::ignore = ExecStatus;
std::ignore = Notify;
std::ignore = UserData;
urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__);
logger::error("[UR][L0] {} function not implemented!\n", __FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove an extra newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe \n is still here (I hope Patryk was talking about this, not something else)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is what I meant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This time for sure - Done

@@ -69,7 +70,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
}

if (ZeResult != ZE_RESULT_SUCCESS) {
urPrint("zeInit: Level Zero initialization failure\n");
logger::debug("zeInit: Level Zero initialization failure");
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like at least a warning message, not debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

urPrint("urSamplerCreate: unsupported "
"UR_SAMPLER_PROPERTIES_ADDRESSING_MODEE "
"value\n");
logger ::error("urSamplerCreate: unsupported "
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove a whitespace after the namespace name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dpne

@lplewa lplewa force-pushed the l0-log branch 2 times, most recently from 8f94c57 to b817812 Compare November 6, 2023 15:35
@PatKamin
Copy link
Contributor

PatKamin commented Nov 8, 2023

Why do you think that it will not work?

I'm not sure if it will print a kind of "pretty" name of the function. I mean not "heavily" mangled in such a way that it's uncertain what the name of the function is. Could you paste some example logs?

@lplewa
Copy link
Contributor Author

lplewa commented Nov 8, 2023

Why do you think that it will not work?

I'm not sure if it will print a kind of "pretty" name of the function. I mean not "heavily" mangled in such a way that it's uncertain what the name of the function is. Could you paste some example logs?

Technically it is compiler specific, but i tested few compilers and it's allways not mangled
I think this example will make better job as an example.
image

@@ -482,8 +484,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetInfo(
return UR_RESULT_ERROR_UNKNOWN;
}
default:
urPrint("Unsupported ParamName in urKernelGetInfo: ParamName=%d(0x%x)\n",
ParamName, ParamName);
logger::error("Unsupported ParamName in urKernelGetInfo: ParamName={}\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove \n

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -541,8 +543,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetGroupInfo(
return ReturnValue(uint32_t{Kernel->ZeKernelProperties->privateMemSize});
}
default: {
urPrint("Unknown ParamName in urKernelGetGroupInfo: ParamName=%d(0x%x)\n",
ParamName, ParamName);
logger::error("Unknown ParamName in urKernelGetGroupInfo: ParamName=%d\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove \n

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -48,7 +48,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
}

if (getenv("SYCL_ENABLE_PCI") != nullptr) {
urPrint("WARNING: SYCL_ENABLE_PCI is deprecated and no longer needed.\n");
logger::warning(
"WARNING: SYCL_ENABLE_PCI is deprecated and no longer needed.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the WARNING word as the logger should provide this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -2020,7 +2022,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(
std::ignore = PropSize;
std::ignore = ImgInfo;
std::ignore = PropSizeRet;
urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__);
logger::debug("{} function not implemented!", __FUNCTION__);
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of this kind of messages (function not implemented) are of the debug type whereas most are of the error type (in other files, too). Shouldn't they be unified and have the same log level across the level zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@lplewa lplewa force-pushed the l0-log branch 2 times, most recently from c814752 to a325bef Compare November 9, 2023 15:15
@lplewa lplewa marked this pull request as ready for review November 9, 2023 15:27
@lplewa lplewa requested review from a team as code owners November 9, 2023 15:27
@lplewa lplewa force-pushed the l0-log branch 2 times, most recently from 4a06c96 to 953c95c Compare November 9, 2023 15:57
Copy link
Contributor

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@EwanC EwanC left a comment

Choose a reason for hiding this comment

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

I've not evaluated the overall change to use the logger framework, but changes to source/adapters/level_zero/command_buffer.cpp look consistent

Copy link
Contributor

@isaacault isaacault left a comment

Choose a reason for hiding this comment

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

source/adapters/level_zero/image.cpp LGTM

Copy link
Contributor

@przemektmalon przemektmalon left a comment

Choose a reason for hiding this comment

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

image.cpp changes LGTM

@jandres742
Copy link

@lplewa : do we have intel/llvm PR testing this? I want to make sure there are no sycl tests relying on those strings. If so, we would need to have the intel/llvm PR to modify also the tests.

@kswiecicki
Copy link
Contributor

@lplewa the SYCL testing process for adapter changes is available here: https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/CONTRIB.rst#adapter-change-process

@lplewa lplewa requested a review from a team as a code owner November 24, 2023 16:44
@fabiomestre fabiomestre changed the base branch from adapters to main December 5, 2023 16:51
@pbalcer pbalcer added the ready to merge Added to PR's which are ready to merge label Feb 8, 2024
@lplewa
Copy link
Contributor Author

lplewa commented Feb 8, 2024

I spited this PR to two PR
First part is here:
#1327
and when it will be merged i will rebase this PR to include only changes in levelzero adapter. This will allow me to create PR with changes in other adapters without dependencies, to this PR

@lplewa
Copy link
Contributor Author

lplewa commented Feb 20, 2024

I created an octopus merge b45470f of all logs changes (#1359; #1347; #1345; #1342; #1032) and tested integration with intel/llvm repository

@lplewa lplewa changed the title change urprint to the new logger framework Refactor Level Zero Adapter to use new logger Feb 20, 2024
@lplewa lplewa force-pushed the l0-log branch 3 times, most recently from 7c34115 to ae5d576 Compare March 19, 2024 16:28
@kbenzie kbenzie added the level-zero L0 adapter specific issues label Apr 3, 2024
@github-actions github-actions bot added images UR images command-buffer Command Buffer feature addition/changes/specification labels Apr 22, 2024
This commit refactors the Level Zero adapter to adopt the new logger
introduced in d9cd223 (Integrate logger with library, 2023-02-03).

Signed-off-by: Łukasz Plewa <lukasz.plewa@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-buffer Command Buffer feature addition/changes/specification images UR images level-zero L0 adapter specific issues ready to merge Added to PR's which are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.