-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add MPS bbox overlap (#2123)
* add mps bbox overlap * format * update document and manifest * update readme
- Loading branch information
q.yao
authored
Jul 22, 2022
1 parent
7306643
commit 22fadce
Showing
12 changed files
with
687 additions
and
122 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
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,64 @@ | ||
// Copyright © 2022 Apple Inc. | ||
|
||
// This file is modify from: | ||
// https://github.com/pytorch/pytorch/blob/a85d1f0bcdd02cf18d3b0517337458cb51a18cdb/aten/src/ATen/mps/MPSDevice.h | ||
|
||
#pragma once | ||
#include <ATen/ATen.h> | ||
#include <c10/macros/Macros.h> | ||
#include <c10/util/Exception.h> | ||
|
||
#ifdef __OBJC__ | ||
#include <Foundation/Foundation.h> | ||
#include <Metal/Metal.h> | ||
#include <MetalPerformanceShaders/MetalPerformanceShaders.h> | ||
typedef id<MTLDevice> MTLDevice_t; | ||
#else | ||
typedef void* MTLDevice; | ||
typedef void* MTLDevice_t; | ||
#endif | ||
|
||
using namespace std; | ||
|
||
namespace at { | ||
namespace mps { | ||
|
||
//----------------------------------------------------------------- | ||
// MPSDevice | ||
// | ||
// MPSDevice is a singleton class that returns the default device | ||
//----------------------------------------------------------------- | ||
|
||
class TORCH_API MPSDevice { | ||
public: | ||
/** | ||
* MPSDevice should not be cloneable. | ||
*/ | ||
MPSDevice(MPSDevice& other) = delete; | ||
/** | ||
* MPSDevice should not be assignable. | ||
*/ | ||
void operator=(const MPSDevice&) = delete; | ||
/** | ||
* Gets single instance of the Device. | ||
*/ | ||
static MPSDevice* getInstance(); | ||
/** | ||
* Returns the single device. | ||
*/ | ||
MTLDevice_t device() { return _mtl_device; } | ||
|
||
~MPSDevice(); | ||
|
||
private: | ||
static MPSDevice* _device; | ||
MTLDevice_t _mtl_device; | ||
MPSDevice(); | ||
}; | ||
|
||
TORCH_API bool is_available(); | ||
|
||
TORCH_API at::Allocator* GetMPSAllocator(bool useSharedAllocator = false); | ||
|
||
} // namespace mps | ||
} // namespace at |
Oops, something went wrong.