Commit 7739077a authored by Josh Fromm's avatar Josh Fromm Committed by Facebook GitHub Bot
Browse files

Hipify various dependencies to enable AMD Face Enhancer

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/675

This diff extends several targets to be hip compatible and fixes a few silly hipification issues with those targets.

After these changes, all dependencies needed for the face enhancer can compile with AMD.

A few silly issues that I had to hack around, maybe we could improve hipification to avoid similar issues in the future:
* Some of the dependencies used sources in `src/cuda/**.cu`. Hipification tried to rename "cuda" to "hip" and broke the paths. I'm not sure where that rename happens so I just changed the directory from "cuda" to "gpu" to avoid the issue.
* One header import called `THCAtomics.cuh` was incorrectly being renamed to `THHAtomics.cuh`, which doesnt exist. Fortunately an equivalent import that doesnt have name issues was available.

We also might want to consider graduating the cpp_library_hip bazel helper out of fbgemm since it seems pretty generally useful.

For some of the targets, we needed to build a python cpp extension, which as far as I can tell we didnt have good hipification for yet. I added a new buck rule very similar to our standard cpp_library_hip rule that creates an extension instead. It's a little copy-pasted so if there are cleaner ways to work around this requirement let me know.

Reviewed By: houseroad

Differential Revision: D61080247

fbshipit-source-id: dc6f101eb3eadfd43ef5610c651b1639e4c78ae6
parent e09224b8
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*/ */
#include <vector> #include <vector>
#include "cuda/ms_deform_im2col_cuda.cuh" #include "ms_deform_im2col_cuda.cuh"
#include <ATen/ATen.h> #include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/CUDAContext.h>
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
#include <ATen/ATen.h> #include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/CUDAContext.h>
#include <ATen/cuda/Atomic.cuh>
#include <THC/THCAtomics.cuh>
#define CUDA_KERNEL_LOOP(i, n) \ #define CUDA_KERNEL_LOOP(i, n) \
for (int i = blockIdx.x * blockDim.x + threadIdx.x; \ for (int i = blockIdx.x * blockDim.x + threadIdx.x; \
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "cpu/ms_deform_attn_cpu.h" #include "cpu/ms_deform_attn_cpu.h"
#ifdef WITH_CUDA #ifdef WITH_CUDA
#include "cuda/ms_deform_attn_cuda.h" #include "gpu/ms_deform_attn_cuda.h"
#endif #endif
...@@ -59,4 +59,3 @@ ms_deform_attn_backward( ...@@ -59,4 +59,3 @@ ms_deform_attn_backward(
} }
AT_ERROR("Not implemented on the CPU"); AT_ERROR("Not implemented on the CPU");
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment