Skip to content

Commit

Permalink
Merge pull request #63 from ROCm/ci_clang_31_2
Browse files Browse the repository at this point in the history
Merge fixes to 31 QA
  • Loading branch information
pramenku authored Nov 6, 2024
2 parents 76bb7ac + 52d2b9d commit 9baff69
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ HIP_RUNTIME_LIBRARY = '%{hip_runtime_library}'
ROCR_RUNTIME_PATH = '%{rocr_runtime_path}'
ROCR_RUNTIME_LIBRARY = '%{rocr_runtime_library}'
VERBOSE = '%{crosstool_verbose}'=='1'
ROCM_AMDGPU_TARGETS = '%{rocm_amdgpu_targets}'

def Log(s):
print('gpus/crosstool: {0}'.format(s))
Expand Down Expand Up @@ -96,6 +97,29 @@ def GetHostCompilerOptions(argv):

return opts

def GetHipccOptions(argv):
"""Collect the -hipcc_options values from argv.
Args:
argv: A list of strings, possibly the argv passed to main().
Returns:
The string that can be passed directly to hipcc.
"""

parser = ArgumentParser()
parser.add_argument('--offload-arch', nargs='*', action='append')
# TODO find a better place for this
parser.add_argument('-gline-tables-only', action='store_true')

args, _ = parser.parse_known_args(argv)

hipcc_opts = ' -gline-tables-only ' if args.gline_tables_only else ''
if args.offload_arch:
hipcc_opts = hipcc_opts + ' '.join(['--offload-arch=' + a for a in sum(args.offload_arch, [])])

return hipcc_opts

def system(cmd):
"""Invokes cmd with os.system().
Expand All @@ -112,7 +136,6 @@ def system(cmd):
else:
return -os.WTERMSIG(retv)


def InvokeHipcc(argv, log=False):
"""Call hipcc with arguments assembled from argv.
Expand All @@ -125,6 +148,7 @@ def InvokeHipcc(argv, log=False):
"""

host_compiler_options = GetHostCompilerOptions(argv)
hipcc_compiler_options = GetHipccOptions(argv)
opt_option = GetOptionValue(argv, 'O')
m_options = GetOptionValue(argv, 'm')
m_options = ''.join([' -m' + m for m in m_options if m in ['32', '64']])
Expand Down Expand Up @@ -163,7 +187,7 @@ def InvokeHipcc(argv, log=False):
srcs = ' '.join(src_files)
out = ' -o ' + out_file[0]

hipccopts = ' '
hipccopts = hipcc_compiler_options + ' '
# In hip-clang environment, we need to make sure that hip header is included
# before some standard math header like <complex> is included in any source.
# Otherwise, we get build error.
Expand Down Expand Up @@ -219,6 +243,7 @@ def main():

if VERBOSE: print('PWD=' + os.getcwd())
if VERBOSE: print('HIPCC_ENV=' + HIPCC_ENV)
if VERBOSE: print('ROCM_AMDGPU_TARGETS= ' + ROCM_AMDGPU_TARGETS)

if args.x and args.x[0] == 'rocm':
# compilation for GPU objects
Expand Down
5 changes: 4 additions & 1 deletion third_party/tsl/third_party/gpus/rocm_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _genrule(src_dir, genrule_name, command, outs):
)

def _compute_rocm_extra_copts(repository_ctx, amdgpu_targets):
amdgpu_target_flags = ["--amdgpu-target=" +
amdgpu_target_flags = ["--offload-arch=" +
amdgpu_target for amdgpu_target in amdgpu_targets]
return str(amdgpu_target_flags)

Expand Down Expand Up @@ -749,6 +749,9 @@ def _create_local_rocm_repository(repository_ctx):
"%{hip_runtime_library}": "amdhip64",
"%{crosstool_verbose}": _crosstool_verbose(repository_ctx),
"%{gcc_host_compiler_path}": str(cc),
"%{rocm_amdgpu_targets}": ",".join(
["\"%s\"" % c for c in rocm_config.amdgpu_targets],
),
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ class MixedTypeTest : public GpuCodegenTest,
}
}

se::GpuComputeCapability GetGpuComputeCapability() {
return backend()
.default_stream_executor()
->GetDeviceDescription()
.gpu_compute_capability();
}

void SetUp() override {
if (std::holds_alternative<se::RocmComputeCapability>(GetGpuComputeCapability())) {
GTEST_SKIP() << "Related fusions are not performed on ROCm without Triton.";
}
}

DebugOptions GetDebugOptionsForTest() override {
DebugOptions debug_options = GpuCodegenTest::GetDebugOptionsForTest();
// We are testing Triton, remove cuBLAS fallback for these tests.
Expand Down

0 comments on commit 9baff69

Please sign in to comment.