-
Notifications
You must be signed in to change notification settings - Fork 230
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
[SWDEV-492880] Add ROCm path for hipRTC #3391
base: develop
Are you sure you want to change the base?
Conversation
src/comgr.cpp
Outdated
@@ -990,7 +990,7 @@ void BuildHip(const std::string& name, | |||
return StartsWith(s, "--std=") || StartsWith(s, "-std="); | |||
})) | |||
opts.push_back("-std=c++17"); | |||
|
|||
opts.push_back("-I/opt/rocm/include"); |
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.
Open for suggestions: For dealing with no symbolic link to the rocm directory cases
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.
I'll approve because this will be correct for the case with the symbolic link present and doesn't present complications otherwise.
In the case where rocm is installed somewhere else, this change would not be sufficient. That path might be part of the CMAKE_PREFIX_PATH.
Thanks for the input. For my understanding, the CMAKE_PREFIX_PATH is for building the MIOpendriver binary and *.so. This function BuildHip() is to using hipRTC for an online compilation.
I see people using both ROCM_PATH and ROCM_HOME at: cupy/cupy#4493, But ROCM_PATH is recommended. Any suggestions? |
I've seen ROCM_PATH used as well, not familiar with ROCM_HOME |
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.
LGTM
Greetings @huanrwan-amd Heads up, there was a formatting error on these changes. #!/bin/bash
find . -iname '*.h' \
-o -iname '*.hpp' \
-o -iname '*.cpp' \
-o -iname '*.h.in' \
-o -iname '*.hpp.in' \
-o -iname '*.cpp.in' \
-o -iname '*.cl' \
| grep -v -E '(build/)|(install/)' \
| xargs -n 1 -P $(nproc) -I{} -t clang-format-12 -style=file {} -i 2>/dev/null |
src/comgr.cpp
Outdated
@@ -991,6 +991,19 @@ void BuildHip(const std::string& name, | |||
})) | |||
opts.push_back("-std=c++17"); | |||
|
|||
const char* rocm_path = std::getenv("ROCM_PATH"); |
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.
There is an error on this line for the checker, I think we need to use the MIOpen Macros instead.
Ex:
// at top of file
MIOPEN_DECLARE_ENV_VAR_STR(MIOPEN_CUSTOM_CACHE_DIR)
// etc.
// usage example
const auto& custom = env::value(MIOPEN_CUSTOM_CACHE_DIR);
if(!custom.empty())
{
p = ExpandUser(custom);
}
It will also be a string type, and you can avoid some of the below manual conversions to std::string.
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.
And the most important part, it caches the results, that all the consequence compilations with get that path much faster.
Also it supports default values, so path.empty()
check is not required - it either returns user-provided path or default /opt/rocm
and that result is cached.
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.
Hi @CAHEK7 , thank you very much for providing comments and instructions. There would be some cases where ROCM_PATH is not there at all. I checked with a clean installation of ROCm6.2.4. No ROCM_PATH...
So I think give a default value here is useful here to use hipRTC out of box, although we can capture this built options strings through logs printed below and add ROCM_PATH manually.
It's also here https://github.com/ROCm/MIOpen/wiki/How-to-format-code |
@huanrwan-amd Looks like some new formatting errors on this PR. |
Thank you for the reminder, ran scripts and pushed the changes. |
This fix is for #3314 .
As in the issue: "hipRTC/Comgr automatically added -I /opt/rocm/include to kernel compilations. However, this behavior is being removed, as hipRTC has no guarantees about a system ROCm installation during kernel compilation/execution."