Skip to content

Commit a24501c

Browse files
committed
Avoid circular dep
1 parent 85d58fb commit a24501c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/torchcodec/_core/Cache.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <torch/types.h>
1010
#include <memory>
1111
#include <mutex>
12-
#include "src/torchcodec/_core/CUDACommon.h"
1312

1413
namespace facebook::torchcodec {
1514

@@ -96,6 +95,11 @@ class PerGpuCache {
9695
std::vector<std::unique_ptr<Cache<T, D>>> cache_;
9796
};
9897

98+
// Forward declaration of getDeviceIndex which exists in CUDACommon.h
99+
// This avoids circular dependency between Cache.h and CUDACommon.cpp which also
100+
// needs to include Cache.h
101+
int getDeviceIndex(const torch::Device& device);
102+
99103
template <typename T, typename D>
100104
bool PerGpuCache<T, D>::addIfCacheHasCapacity(
101105
const torch::Device& device,

0 commit comments

Comments
 (0)