Commit 2b54f80
OSS MPZCH CUDA kernel in FBGEMM (#4214)
Summary:
Pull Request resolved: #4214
X-link: facebookresearch/FBGEMM#1290
Opensource FBGEMM CUDA Kernel for MPZCH feature
### Major changes
- Create a folder named `faster_hash` under the `fbgemm/fbgemmgpu/src` folder.
- Copy the following files to the created folder from `fbsource/fbcode/caffe2/torch/fb/retrieval`
- faster_hash.cpp
- faster_hash.cu
- common_utils.cuh
- Revise the `faster_hash.cpp`
- Change `namespace fb` to `namespace fbgemm_gpu`.
- Comment out `using namespace torch::fb::turborec;`
- Change `TORCH_LIBRARY_IMPL(fb, ...)` to `TORCH_LIBRARY_IMPL(fbgemm, ...)`
- Fix namespace calling issue due to the namespace change.
- Revise the `faster_hash.cu`
- Change `namespace fb` to `namespace fbgemm_gpu`.
- Change `TORCH_LIBRARY_IMPL(fb, ...)` to `TORCH_LIBRARY_IMPL(fbgemm, ...)`
- Fix namespace calling issue due to the namespace change.
- Revise the `common_utils.cuh` file
- Change `namespace fb` to `namespace fbgemm_gpu`.
- Add a BUCK file to compile the cpp and cuda library.
- Copy the `faster_hash_test.py` file to the `fbgemm/fbgemm_gpu/test` folder.
- Add a section in the BUCK file under the `test` folder for `python_unittest` of `faster_hash_test`.
- In the `faster_hash_test.py` file
- Load the `faster_hash` related libraries with `torch.ops.load` API.
- Replace all the `torch.ops.fb` to `torch.ops.fbgemm`.
- Following other test files to add `opensource` and `gpu availability` check.
### Questions
- After refactorying, the API calls `torch.ops.create_zch_buffer`, `torch.ops.zero_collision_hash`, `torch.ops.fbgemm.zero_collision_hash`, and `torch.ops.fbgemm.create_zch_buffer` are all valid, while `torch.ops.create_zch_buffer` and `torch.ops.zero_collision_hash` may incur certain parameter mismatches. How to resolve this issue and disable the API calls without `fbgemm`?
- How to integrate the refactoryed library into fbgemm so the test can call something like `from fbgemm_gpu import create_zch_buffer, zero_collision_hash`?
Differential Revision: D755050201 parent 9ba0bf5 commit 2b54f80
File tree
4 files changed
+3274
-0
lines changed- fbgemm_gpu
- src/faster_hash_ops
- test
4 files changed
+3274
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
0 commit comments