| #include <metal_stdlib> | |
| using namespace metal; | |
| template<typename T, size_t N> | |
| struct tint_array { | |
| const constant T& operator[](size_t i) const constant { return elements[i]; } | |
| device T& operator[](size_t i) device { return elements[i]; } | |
| const device T& operator[](size_t i) const device { return elements[i]; } | |
| thread T& operator[](size_t i) thread { return elements[i]; } | |
| const thread T& operator[](size_t i) const thread { return elements[i]; } | |
| threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } | |
| const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } | |
| T elements[N]; | |
| }; | |
| struct ssbOut { | |
| /* 0x0000 */ tint_array<float, 1> result; | |
| }; | |
| struct ssbA { | |
| /* 0x0000 */ tint_array<float, 1> A; | |
| }; | |
| struct Uniforms { | |
| /* 0x0000 */ float tint_symbol; | |
| /* 0x0004 */ int aShape; | |
| /* 0x0008 */ int outShape; | |
| /* 0x000c */ int outShapeStrides; | |
| /* 0x0010 */ int size; | |
| }; | |
| float getAAtOutCoords_(thread uint3* const tint_symbol_2, const device ssbA* const tint_symbol_3) { | |
| uint const x_42 = (*(tint_symbol_2))[0]; | |
| float const x_44 = (*(tint_symbol_3)).A[x_42]; | |
| return x_44; | |
| } | |
| float unaryOperation_f1_(thread float* const a) { | |
| float const x_47 = *(a); | |
| if ((x_47 < 0.0f)) { | |
| return INFINITY; | |
| } | |
| float const x_55 = *(a); | |
| return log(x_55); | |
| } | |
| void setOutput_i1_f1_(thread int* const flatIndex, thread float* const value, device ssbOut* const tint_symbol_4) { | |
| int const x_27 = *(flatIndex); | |
| float const x_28 = *(value); | |
| (*(tint_symbol_4)).result[x_27] = x_28; | |
| return; | |
| } | |
| void main_1(thread uint3* const tint_symbol_5, const constant Uniforms* const tint_symbol_6, const device ssbA* const tint_symbol_7, device ssbOut* const tint_symbol_8) { | |
| int index = 0; | |
| float a_1 = 0.0f; | |
| float param = 0.0f; | |
| int param_1 = 0; | |
| float param_2 = 0.0f; | |
| uint const x_61 = (*(tint_symbol_5))[0]; | |
| index = as_type<int>(x_61); | |
| int const x_63 = index; | |
| int const x_70 = (*(tint_symbol_6)).size; | |
| if ((x_63 < x_70)) { | |
| float const x_75 = getAAtOutCoords_(tint_symbol_5, tint_symbol_7); | |
| a_1 = x_75; | |
| float const x_77 = a_1; | |
| param = x_77; | |
| float const x_78 = unaryOperation_f1_(&(param)); | |
| int const x_80 = index; | |
| param_1 = x_80; | |
| param_2 = x_78; | |
| setOutput_i1_f1_(&(param_1), &(param_2), tint_symbol_8); | |
| } | |
| return; | |
| } | |
| void tint_symbol_1_inner(uint3 gl_GlobalInvocationID_param, thread uint3* const tint_symbol_9, const constant Uniforms* const tint_symbol_10, const device ssbA* const tint_symbol_11, device ssbOut* const tint_symbol_12) { | |
| *(tint_symbol_9) = gl_GlobalInvocationID_param; | |
| main_1(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); | |
| } | |
| kernel void tint_symbol_1(const constant Uniforms* tint_symbol_14 [[buffer(0)]], const device ssbA* tint_symbol_15 [[buffer(2)]], device ssbOut* tint_symbol_16 [[buffer(1)]], uint3 gl_GlobalInvocationID_param [[thread_position_in_grid]]) { | |
| thread uint3 tint_symbol_13 = 0u; | |
| tint_symbol_1_inner(gl_GlobalInvocationID_param, &(tint_symbol_13), tint_symbol_14, tint_symbol_15, tint_symbol_16); | |
| return; | |
| } | |