12#ifndef GPURECONSTRUCTIONOMETALINCLUDESHOST_H
13#define GPURECONSTRUCTIONOMETALINCLUDESHOST_H
16#error "this header establishes GPUCA_GPUTYPE_METAL and __METAL_HOST__, so it must be included before any other GPU header"
19#define GPUCA_GPUTYPE_METAL
21#import <Metal/Metal.h>
22#ifndef __METAL_VERSION__
30#import <Foundation/Foundation.h>
36#include <condition_variable>
37#include <unordered_map>
39#include <mach/mach_time.h>
59 std::array<id<MTLCommandQueue>, constants::GPU_MAX_STREAMS>
commandQueues;
64 std::array<std::vector<id<MTLCommandBuffer>>, constants::GPU_MAX_STREAMS>
submittedBuffers;
66 std::array<id<MTLSharedEvent>, constants::GPU_MAX_STREAMS>
streamOrder;
70 std::array<id<MTLFence>, constants::GPU_MAX_STREAMS>
streamFence;
77 std::array<std::string, constants::GPU_MAX_STREAMS>
timelineOps;
127 if (
c.status == MTLCommandBufferStatusError &&
event.signaledValue <
value) {
128 event.signaledValue =
value;
154 static const double scale = [] { mach_timebase_info_data_t tb; mach_timebase_info(&tb);
return 1
e-9 * tb.numer / tb.denom; }();
155 return mach_absolute_time() * scale;
161 snprintf(
buf,
sizeof(
buf),
" %s:%p=%llu",
op,
id, (
unsigned long long)
value);
172 [encoder setBytes:&word
length:
sizeof(word) atIndex:1];
173 [encoder dispatchThreadgroups:MTLSizeMake(1, 1, 1) threadsPerThreadgroup:MTLSizeMake(1, 1, 1)];
179 [encoder endEncoding];
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
GLsizei const GLfloat * value
GLuint GLsizei GLsizei * length
GLenum GLuint GLenum GLsizei const GLchar * buf
void metalLimitStreamsInFlight(GPUReconstructionMetalInternals *internals, id< MTLCommandBuffer > cb, int32_t stream)
void metalEndEncoder(GPUReconstructionMetalInternals *internals, E encoder, int32_t stream)
void metalTimelineAdd(GPUReconstructionMetalInternals *internals, int32_t stream, const char *op, const void *id, uint64_t value)
void metalEncodeCanary(GPUReconstructionMetalInternals *internals, id< MTLComputeCommandEncoder > encoder, uint64_t word)
void metalBeginEncoder(GPUReconstructionMetalInternals *internals, E encoder, int32_t stream)
void metalSignalOnError(id< MTLCommandBuffer > cb, id< MTLSharedEvent > event, uint64_t value)