Migrate OMP use to Aten/Parallel.h (#5947)#5947
Closed
q10 wants to merge 1 commit into
Closed
Conversation
Contributor
|
@q10 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109460231. |
q10
pushed a commit
to q10/FBGEMM
that referenced
this pull request
Jun 23, 2026
Summary: X-link: facebookresearch/FBGEMM#2862 This is the only direct use of `omp` in the library, and I believe that if we migrate to using `Aten/Parallel.h` it will use `omp` under the hood if `pytorch` is built with `AT_PARALLEL_OPENMP` set to 1 anyway, so this allows `fbgemm_gpu` users to set their threading model consistently based on their PyTorch build. Test Plan: Ran the CPU unit test that directly exercises the rewritten `csr2csc_template_` (the function this diff migrates from `#pragma omp` to `at::parallel_for`), covering both `index_t` instantiations: ``` buck2 test fbcode//mode/opt fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:cpu_kernel ``` Result: Pass 2. Fail 0. (CpuKernelTest.csr2csc_test_int32, CpuKernelTest.csr2csc_test_int64) Test session: https://www.internalfb.com/intern/testinfra/testrun/26458647838875303 Higher-level TBE suites that exercise csr2csc indirectly: ``` buck2 test fbcode//mode/opt \ fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:forward \ fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:backward_sgd ``` Not exercised locally: the Python test runtime fails with `cannot execute binary file: Exec format error` (signal 126) on this aarch64 devserver, including the CPU-only cases (e.g. test_forward_cpu_fp32, test_backward_sgd_fp32_pmNONE_cpu). This is a host arch/toolchain limitation, not a code issue. Run these on an x86_64 GPU host or via Sandcastle CI. Differential Revision: D109460231 Pulled By: q10
Summary: Pull Request resolved: pytorch#5947 X-link: https://github.com/facebookresearch/FBGEMM/pull/2862 This is the only direct use of `omp` in the library, and I believe that if we migrate to using `Aten/Parallel.h` it will use `omp` under the hood if `pytorch` is built with `AT_PARALLEL_OPENMP` set to 1 anyway, so this allows `fbgemm_gpu` users to set their threading model consistently based on their PyTorch build. Pull Request resolved: pytorch#5943 Test Plan: Ran the CPU unit test that directly exercises the rewritten `csr2csc_template_` (the function this diff migrates from `#pragma omp` to `at::parallel_for`), covering both `index_t` instantiations: ``` buck2 test fbcode//mode/opt fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:cpu_kernel ``` Result: Pass 2. Fail 0. (CpuKernelTest.csr2csc_test_int32, CpuKernelTest.csr2csc_test_int64) Test session: https://www.internalfb.com/intern/testinfra/testrun/26458647838875303 Higher-level TBE suites that exercise csr2csc indirectly: ``` buck2 test fbcode//mode/opt \ fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:forward \ fbcode//deeplearning/fbgemm/fbgemm_gpu/test/tbe:backward_sgd ``` Not exercised locally: the Python test runtime fails with `cannot execute binary file: Exec format error` (signal 126) on this aarch64 devserver, including the CPU-only cases (e.g. test_forward_cpu_fp32, test_backward_sgd_fp32_pmNONE_cpu). This is a host arch/toolchain limitation, not a code issue. Run these on an x86_64 GPU host or via Sandcastle CI. Differential Revision: D109460231 Pulled By: q10
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/2862
This is the only direct use of
ompin the library, and I believe that if we migrate to usingAten/Parallel.hit will useompunder the hood ifpytorchis built withAT_PARALLEL_OPENMPset to 1 anyway, so this allowsfbgemm_gpuusers to set their threading model consistently based on their PyTorch build.Test Plan:
Ran the CPU unit test that directly exercises the rewritten
csr2csc_template_(the function this diff migrates from#pragma omptoat::parallel_for), covering bothindex_tinstantiations:Result: Pass 2. Fail 0. (CpuKernelTest.csr2csc_test_int32, CpuKernelTest.csr2csc_test_int64)
Test session: https://www.internalfb.com/intern/testinfra/testrun/26458647838875303
Higher-level TBE suites that exercise csr2csc indirectly:
Not exercised locally: the Python test runtime fails with
cannot execute binary file: Exec format error(signal 126) on this aarch64 devserver, including the CPU-only cases (e.g. test_forward_cpu_fp32, test_backward_sgd_fp32_pmNONE_cpu). This is a host arch/toolchain limitation, not a code issue. Run these on an x86_64 GPU host or via Sandcastle CI.Differential Revision: D109460231
Pulled By: q10