Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL compiler error #250

Closed
PatchByte opened this issue Jan 25, 2025 · 8 comments
Closed

OpenCL compiler error #250

PatchByte opened this issue Jan 25, 2025 · 8 comments

Comments

@PatchByte
Copy link
Contributor

System Details

  • OS: Linux Fedora 41
  • GPU: AMD RX 7800 XT

Log

[hesiod] [13:49:22] [---I---] Welcome to Hesiod v0.0.0!
2025-01-25 13:49:22 | DEBUG   | device_manager.cpp | DeviceManager:26 | DeviceManager::DeviceManager
2025-01-25 13:49:22 | DEBUG   | device_manager.cpp | DeviceManager:29 | initializing OpenCL devices...
2025-01-25 13:49:22 | DEBUG   | device_manager.cpp | DeviceManager:41 | checking device performances...
2025-01-25 13:49:22 | DEBUG   | device_manager.cpp | DeviceManager:71 | rating - device: gfx1101, vendor: Advanced Micro Devices, Inc., rating: 63720
2025-01-25 13:49:22 | DEBUG   | device_manager.cpp | DeviceManager:82 | OpenCL device: gfx1101
2025-01-25 13:49:22 | DEBUG   | kernel_manager.cpp | build_program:28 | loading kernel sources
2025-01-25 13:49:22 | ERROR   | kernel_manager.cpp | build_program:67 | program building skipped, kernel sources are empty
2025-01-25 13:49:22 | DEBUG   | kernel_manager.cpp | build_program:28 | loading kernel sources
2025-01-25 13:49:22 | DEBUG   | kernel_manager.cpp | build_program:40 | building OpenCL kernels
2025-01-25 13:49:22 | DEBUG   | kernel_manager.cpp | build_program:46 | building options: -DBLOCK_SIZE=8
2025-01-25 13:49:24 | ERROR   | kernel_manager.cpp | build_program:52 | build error
 Error building, compiler says:
----------------------------------------------
ld.lld: error: undefined symbol: pown(float, int)
>>> referenced by /tmp/comgr-fb5ae5/input/linked.bc.o:(maximum_smooth)
>>> referenced by /tmp/comgr-fb5ae5/input/linked.bc.o:(maximum_smooth)
>>> referenced by /tmp/comgr-fb5ae5/input/linked.bc.o:(minimum_smooth)
>>> referenced 7 more times
Error: Creating the executable from LLVM IRs failed.
----------------------------------------------
terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenCL Error CL_BUILD_PROGRAM _FAILURE [-11]: if there is a failure to build the program executable. This error will be returned if clBuildProgram does not return until the build has completed. Run-time and JIT Compiler Errors (driver-dependent).
[1]    15682 IOT instruction (core dumped)  ./hesiod.AppImage

I tried both the AppImage on the github release page and building it myself.

@otto-link
Copy link
Owner

Strange, it looks like a basic math library is missing in OpenCL for this specific device. Could you post the output of clinfo (sudo dnf install clinfo) to check which extensions are available on your device?

@otto-link
Copy link
Owner

Here is patch that should do the trick: https://ghostbin.site/66dmm

  • download this file 66dmm.txt and place it in Hesiod/external/HighMap
  • apply the patch: in a terminal, navigate to Hesiod/external/HighMap and then git apply 66dmm.txt
  • compile and... ?

@PatchByte
Copy link
Contributor Author

This is my clinfo output:

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3625.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx1101
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0 
  Driver Version                                  3625.0 (HSA1.1,LC)
  Device OpenCL C Version                         OpenCL C 2.0 
  Device Type                                     GPU
  Device Board Name (AMD)                         AMD Radeon RX 7800 XT
  Device PCI-e ID (AMD)                           0x747e
  Device Topology (AMD)                           PCI-E, 0000:03:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               30
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                32
  SIMD instruction width (AMD)                    1
  Max clock frequency                             2124MHz
  Graphics IP (AMD)                               11.0
  Device Partition                                (core)
    Max number of sub-devices                     30
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple (kernel)     32
  Wavefront width (AMD)                           32
  Preferred / native vector sizes                 
    char                                                 4 / 4       
    short                                                2 / 2       
    int                                                  1 / 1       
    long                                                 1 / 1       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              17163091968 (15.98GiB)
  Global free memory (AMD)                        16402432 (15.64GiB) 16402432 (15.64GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           4
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           14588628168 (13.59GiB)
  Unified memory for Host and Device              No
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   No
    Atomics                                       No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Preferred alignment for atomics                 
    SVM                                           0 bytes
    Global                                        0 bytes
    Local                                         0 bytes
  Max size for global variable                    14588628168 (13.59GiB)
  Preferred total size of global vars             17163091968 (15.98GiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        32768 (32KiB)
  Global Memory cache line size                   128 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 8192 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             16384x16384x8192 pixels
    Max number of read image args                 128
    Max number of write image args                8
    Max number of read/write image args           64
  Max number of pipe args                         16
  Max active pipe reservations                    16
  Max pipe packet size                            1703726280 (1.587GiB)
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Local memory size per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        14588628168 (13.59GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties (on host)                      
    Out-of-order execution                        No
    Profiling                                     Yes
  Queue properties (on device)                    
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                262144 (256KiB)
    Max size                                      8388608 (8MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    Yes
  Number of P2P devices (AMD)                     0
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        0ns (Thu Jan  1 01:00:00 1970)
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  No
    Number of async queues (AMD)                  8
    Max real-time compute queues (AMD)            8
    Max real-time compute units (AMD)             30
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_depth_images cl_amd_copy_buffer_p2p cl_amd_assembly_program 

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  AMD Accelerated Parallel Processing
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [AMD]
  clCreateContext(NULL, ...) [default]            Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   gfx1101

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.3.2
  ICD loader Profile                              OpenCL 3.0

@PatchByte
Copy link
Contributor Author

I applied your patch (manually because git didn't want to apply it)
This is now the output of hesiod:

[hesiod] [12:39:57] [---I---] Welcome to Hesiod v0.0.0!
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:28 | DeviceManager::DeviceManager
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:31 | initializing OpenCL devices...
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:43 | checking device performances...
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:47 | checking platform: Advanced Micro Devices, Inc. - AMD Accelerated Parallel Processing
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:81 | rating - device: gfx1101, vendor: Advanced Micro Devices, Inc., rating: 63720
2025-01-26 12:39:57 | DEBUG   | device_manager.cpp | DeviceManager:94 | OpenCL device: gfx1101
2025-01-26 12:39:57 | DEBUG   | kernel_manager.cpp | build_program:28 | loading kernel sources
2025-01-26 12:39:57 | ERROR   | kernel_manager.cpp | build_program:62 | program building skipped, kernel sources are empty
2025-01-26 12:39:57 | DEBUG   | kernel_manager.cpp | build_program:28 | loading kernel sources
2025-01-26 12:39:57 | DEBUG   | kernel_manager.cpp | build_program:40 | building OpenCL kernels
2025-01-26 12:39:58 | ERROR   | kernel_manager.cpp | build_program:47 | build error
 Error building, compiler says:
----------------------------------------------
ld.lld: error: undefined symbol: powr(float, float)
>>> referenced by /tmp/comgr-aa89be/input/linked.bc.o:(sdf_2d_polyline_bezier)
>>> referenced by /tmp/comgr-aa89be/input/linked.bc.o:(sdf_2d_polyline_bezier)

ld.lld: error: undefined symbol: pown(float, int)
>>> referenced by /tmp/comgr-aa89be/input/linked.bc.o:(noise_voronoise)
>>> referenced by /tmp/comgr-aa89be/input/linked.bc.o:(noise_voronoise)
Error: Creating the executable from LLVM IRs failed.
----------------------------------------------
terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenCL Error CL_BUILD_PROGRAM _FAILURE [-11]: if there is a failure to build the program executable. This error will be returned if clBuildProgram does not return until the build has completed. Run-time and JIT Compiler Errors (driver-dependent).
[1]    28968 IOT instruction (core dumped)  ./hesiod
git:(main) 

@otto-link
Copy link
Owner

I'm not an OpenCL expert and the doc is somehow cryptic... But I guess some float functions may be missing on some GPUs 😕

I created a branch with the fixes:

You may have to force the update of the submodule HighMap. To be sure, got to external/HighMap and do a git pull then git checkout 270-fix-opencl-compiler-errors.

Could you try again?

(thanks btw!)

@PatchByte
Copy link
Contributor Author

Oh yes this fixed everything, thank you!

@PatchByte
Copy link
Contributor Author

I am not sure weather I should close the issue now, or wait for the merge 😅

@otto-link
Copy link
Owner

don't worry, I'll close the issue after merging it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants