diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.41k stars 166 forks source link

OpenCL and Macbook M1 pro - Program that uses builint hist fails to run #2135

Closed matheussbernardo closed 7 months ago

matheussbernardo commented 7 months ago

Hello! When I execute this program compiled with futhark opencl

def main (xs: []i64) (is: []i64) = hist (+) 0 10 is xs

It fails with some cryptic opencl error

`UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed ./exercise_2_3: Compilation of OpenCL program failed. Build log: program_source:24:26: warning: unsupported OpenCL extension 'cl_khr_byte_addressable_store' - ignoring [-Wignored-pragmas]

pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable

                     ^

program_source:30:26: warning: unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring [-Wignored-pragmas]

pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable

                     ^

program_source:31:26: warning: unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring [-Wignored-pragmas]

pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable

                     ^

program_source:5053:1: warning: unused variable 'global_id_0' [-Wunused-variable] GEN_TRANSPOSE_KERNELS(1b, uint8_t) ....`

athas commented 7 months ago

Apple does not support OpenCL anymore. Their implementation in macOS is now a pretty barebones layer on top of Metal, and does not implement everything needed by Futhark. If you have an Apple machine with an AMD GPU it may be that the OpenCL implementation for that GPU is still sensible, but I don't know.