-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register fake CPU dispatch for new_unified_tensor (#2099)
Summary: Pull Request resolved: #2099 - Register fake CPU dispatch for new_unified_tensor Reviewed By: sryap, spcyppt Differential Revision: D50710925 fbshipit-source-id: 374675364e53a3a5ada2884263b189b97f4453f5
- Loading branch information
1 parent
049f2a9
commit 4651326
Showing
9 changed files
with
112 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <ATen/ATen.h> | ||
#include <ATen/cuda/Exceptions.h> | ||
#include <c10/cuda/CUDAGuard.h> | ||
#include <sys/mman.h> | ||
#include <unistd.h> | ||
#include <cstring> | ||
|
||
#include "common.h" | ||
#include "fbgemm_gpu/cumem_utils.h" | ||
#include "fbgemm_gpu/enum_utils.h" | ||
|
||
namespace fbgemm_gpu { | ||
|
||
FBGEMM_GPU_ENUM_CREATE_TAG(uvm) | ||
|
||
} // namespace fbgemm_gpu |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <ATen/ATen.h> | ||
|
||
using Tensor = at::Tensor; | ||
|
||
namespace fbgemm_gpu { | ||
|
||
Tensor new_unified_tensor_cpu( | ||
const Tensor& self, | ||
const std::vector<std::int64_t>& sizes, | ||
bool is_host_mapped); | ||
|
||
} // namespace fbgemm_gpu |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include "common.h" | ||
|
||
using Tensor = at::Tensor; | ||
|
||
namespace fbgemm_gpu { | ||
|
||
Tensor new_unified_tensor_cpu( | ||
const Tensor& self, | ||
const std::vector<std::int64_t>& sizes, | ||
bool is_host_mapped) { | ||
return at::empty({0}, self.options()); | ||
} | ||
|
||
} // namespace fbgemm_gpu |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <torch/library.h> | ||
#include "common.cuh" | ||
#include "fbgemm_gpu/ops_utils.h" | ||
#include "fbgemm_gpu/sparse_ops_utils.h" | ||
|
||
namespace fbgemm_gpu { | ||
|
||
TORCH_LIBRARY_FRAGMENT(fbgemm, m) { | ||
DISPATCH_TO_CUDA("uvm_to_cpu", uvm_to_cpu); | ||
DISPATCH_TO_CUDA("new_managed_tensor", new_managed_tensor); | ||
DISPATCH_TO_META("new_managed_tensor", new_managed_tensor_meta); | ||
DISPATCH_TO_CUDA("new_host_mapped_tensor", new_host_mapped_tensor); | ||
DISPATCH_TO_CUDA("new_unified_tensor", new_unified_tensor); | ||
DISPATCH_TO_CUDA("new_vanilla_managed_tensor", new_vanilla_managed_tensor); | ||
} | ||
|
||
} // namespace fbgemm_gpu |