Fix: Error messages printed to stderr to trigger CMake Error Variable (#743)
This PR intends to cover the edge case seen in https://github.com/ROCm/rocm-systems/issues/694. `hip-config-amd.cmake` uses rocm_agent_enumerator to determine which GPU architecture to target when no target is specified. https://github.com/ROCm/rocm-systems/blob/9a02dae75f8df9d8f08923d34d06d76e96ced7b4/projects/clr/hipamd/hip-config-amd.cmake.in#L86-L95 On WSL, both `readFromKFD` and `readFromLSPCI` are skipped. If `readFromTargetLstFile()` isn't in use, `readFromROCMINFO()` is called on. If rocminfo times out, it prints the following message to stdout. ``` "Timeout querying rocminfo. Are you compiling with more than 254 threads?" ``` Because this is output and not an explicit error message, `execute_command` in the previous code blocks treats the output as `OUTPUT_VARIABLE` and passes it on as a valid gfx arch which causes these errors in CMake, ``` lang++: error: invalid target ID 'Timeout'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') clang++: error: invalid target ID 'querying'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') clang++: error: invalid target ID 'rocminfo.'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') clang++: error: invalid target ID 'Are'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') clang++: error: invalid target ID 'you'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') clang++: error: invalid target ID 'compiling'; format is a processor name followed by an optional colon-delimited list of features followed by an enable/disable sign (e.g., 'gfx908:sramecc+:xnack-') ``` The output can be properly pushed to `ERROR_VARIABLE` if rocm_agent_enumerator pushes the output to stderr instead of stdout. This can be done with the changes to the print statement in this PR or using the `logging` module.
This commit is contained in:
zatwierdzone przez
GitHub
rodzic
77ed80f457
commit
782dc9214b
@@ -142,7 +142,7 @@ def readFromROCMINFO(search_arch_name = False):
|
||||
t1 = time.time()
|
||||
# quit after retrying rocminfo for a minute.
|
||||
if t1 - t0 > 60.0:
|
||||
print("Timeout querying rocminfo. Are you compiling with more than 254 threads?")
|
||||
print("Timeout querying rocminfo. Are you compiling with more than 254 threads?", file=sys.stderr)
|
||||
break
|
||||
# run rocminfo
|
||||
rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n')
|
||||
|
||||
Reference in New Issue
Block a user