Skip to content

[Feature]: hipcc should try to detect --offload-arch on Windows #302

@ScottTodd

Description

@ScottTodd

Suggestion Description

This code uses rocm_agent_enumerator on Linux:

// No AMDGPU target specified at commandline. So look for HCC_AMDGPU_TARGET
if (default_amdgpu_target == 1) {
if (!var.hccAmdGpuTargetEnv_.empty()) {
targetsStr = var.hccAmdGpuTargetEnv_;
} else if (os != windows) {
// Else try using rocm_agent_enumerator
string ROCM_AGENT_ENUM;
ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator";
targetsStr = ROCM_AGENT_ENUM +" -t GPU";
SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str());
regex toReplace("\n+");
targetsStr = hipBinUtilPtr_->replaceRegex(sysOut.out, toReplace, ",");
}
default_amdgpu_target = 0;
}
// Parse the targets collected in targetStr
// and set corresponding compiler options.
vector<string> targets = hipcc::utils::splitStr(targetsStr, ',');
string GPU_ARCH_OPT = " --offload-arch=";

Windows currently has hipInfo.exe (which is similar to rocminfo). Windows and Linux have amdgpu-arch. It seems like hipcc could try using amdgpu-arch? I'm also wondering if we would want to provide rocm_agent_enumerator on Windows too, and why we have both that and amdgpu-arch.

Context: ROCm/TheRock#1571. We had a test running on Linux and Windows that omitted --offload-arch. This was passing on Linux but silently failing on Windows, until ROCm/rocm-systems@e79eaaa turned the silent failure into a crash. That PR changes the test to explicitly pass --offload-arch on both platforms using amdgpu-arch to look up the gfx target.

Operating System

Windows

GPU

N/A

ROCm Component

hipcc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions