Quantum 3xplorer (Q3)
Loading...
Searching...
No Matches
metal.hpp
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* MetalGPUDeviceBackend forward declaration header.
5
*
6
* Provides the Metal-specific accessors (device, command queue, buffer lookup)
7
* that MPS BLAS and MPSGraph FFT need. This header can be included from
8
* other .mm files without pulling in Metal/Metal.h.
9
*/
10
11
#ifdef __OBJC__
12
#import <Metal/Metal.h>
13
#endif
14
15
#include "
layer_0_core/execution/gpu/device/init.hpp
"
16
17
#include <memory>
18
19
namespace
q3
{
20
namespace
execution {
21
namespace
gpu {
22
namespace
device {
23
24
/**
25
* MetalGPUDeviceBackend — abstract interface for Metal-specific accessors.
26
*
27
* Concrete implementation lives in device/metal.mm.
28
*/
29
class
MetalGPUDeviceBackend
:
public
GPUDeviceBackend
{
30
public
:
31
virtual
~MetalGPUDeviceBackend
() =
default
;
32
33
#ifdef __OBJC__
34
/**
35
* Get the Metal device.
36
*/
37
virtual
id<MTLDevice> metal_device()
const
= 0;
38
39
/**
40
* Get the Metal command queue.
41
*/
42
virtual
id<MTLCommandQueue> metal_command_queue()
const
= 0;
43
44
/**
45
* Look up the MTLBuffer for a pointer allocated by this backend.
46
*
47
* Returns nil if the pointer was not allocated by this backend.
48
*/
49
virtual
id<MTLBuffer> get_metal_buffer(
const
void
* pointer)
const
= 0;
50
#endif
51
};
52
53
}
// namespace device
54
}
// namespace gpu
55
}
// namespace execution
56
}
// namespace q3
q3::execution::gpu::device::GPUDeviceBackend
Definition
init.hpp:22
q3::execution::gpu::device::MetalGPUDeviceBackend
Definition
metal.hpp:29
q3::execution::gpu::device::MetalGPUDeviceBackend::~MetalGPUDeviceBackend
virtual ~MetalGPUDeviceBackend()=default
init.hpp
q3
Definition
q3_core_api.hpp:33
src
layer_0_core
execution
gpu
device
metal.hpp
Generated by
1.9.8