Project
Loading...
Searching...
No Matches
GPUReconstructionMetalIncludesHost.h
Go to the documentation of this file.
1// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef GPURECONSTRUCTIONOMETALINCLUDESHOST_H
13#define GPURECONSTRUCTIONOMETALINCLUDESHOST_H
14
15#ifdef GPUCOMMONDEF_H
16#error "this header establishes GPUCA_GPUTYPE_METAL and __METAL_HOST__, so it must be included before any other GPU header"
17#endif
18
19#define GPUCA_GPUTYPE_METAL
20
21#import <Metal/Metal.h>
22#ifndef __METAL_VERSION__
23// __METAL_VERSION__ is only defined in device code.
24#define __METAL_HOST__
25// The parameter table picks MSL's `half` for the device layouts this translation
26// unit has to agree with; _Float16 is the same IEEE binary16 type.
27using half = _Float16;
28#endif
29
30#import <Foundation/Foundation.h>
31
32#include <vector>
33#include <string>
34#include <memory>
35#include "GPULogging.h"
36
39#include "GPUCommonHelpers.h"
40
41using namespace o2::gpu;
42
43#include <cstring>
44#include <unistd.h>
45#include <typeinfo>
46#include <cstdlib>
47
48namespace o2::gpu
49{
50
53
54 std::array<id<MTLCommandQueue>, constants::GPU_MAX_STREAMS> commandQueues;
55 // The buffer currently open for encoding, plus the ones already committed and
56 // not yet waited for. A Metal command buffer takes one commit and cannot be
57 // encoded into afterwards, so the two cannot be the same object.
58 std::array<id<MTLCommandBuffer>, constants::GPU_MAX_STREAMS> commandBuffers;
59 std::array<std::vector<id<MTLCommandBuffer>>, constants::GPU_MAX_STREAMS> submittedBuffers;
60
61 std::vector<id<MTLFunction>> functions;
62 std::vector<id<MTLComputePipelineState>> pipelines;
63 std::vector<uint32_t> maxThreadsPerGroup;
64
68
70};
71} // namespace o2::gpu
72
73#endif // GPURECONSTRUCTIONOMETALINCLUDESHOST_H
GLuint id
Definition glcorearb.h:650
std::array< id< MTLCommandQueue >, constants::GPU_MAX_STREAMS > commandQueues
std::array< std::vector< id< MTLCommandBuffer > >, constants::GPU_MAX_STREAMS > submittedBuffers
std::array< id< MTLCommandBuffer >, constants::GPU_MAX_STREAMS > commandBuffers
std::vector< id< MTLComputePipelineState > > pipelines