From 607f644316df7777af8df8cf80a1b9aaf224ce89 Mon Sep 17 00:00:00 2001 From: Ramya Ramineni <62723901+rraminen@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:28:03 -0600 Subject: [PATCH] Added __HIP_PLATFORM_AMD__=1 for non JIT build (#4585) This PR is required in addition to https://github.com/microsoft/DeepSpeed/pull/4539 to define HIP_PLATFORM_AMD on ROCm. This is required for DeepSpeed non-JIT build. For JIT build we have https://github.com/microsoft/DeepSpeed/pull/4570. This is required for DeepSpeed extensions build in those docker images with PyTorch built before https://github.com/pytorch/pytorch/pull/111975. cc: @jeffdaily @jithunnair-amd Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com> --- op_builder/builder.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/op_builder/builder.py b/op_builder/builder.py index 3b1730567eef..79692ce05878 100644 --- a/op_builder/builder.py +++ b/op_builder/builder.py @@ -616,6 +616,9 @@ def builder(self): if not self.build_for_cpu and self.enable_bf16: compile_args['cxx'].append("-DBF16_AVAILABLE") + if self.is_rocm_pytorch(): + compile_args['cxx'].append("-D__HIP_PLATFORM_AMD__=1") + cuda_ext = ExtensionBuilder(name=self.absolute_name(), sources=self.strip_empty_entries(self.sources()), include_dirs=self.strip_empty_entries(self.include_paths()),