Bug 2280737

Summary: Fail to compile OpenCL kernels on darktable under Fedora 40 rocm 6.0.2
Product: [Fedora] Fedora Reporter: g-man <forum.undone538>
Component: rocclrAssignee: Jeremy Newton <alexjnewt>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: alexjnewt, rocm-packagers-sig
Target Milestone: ---Keywords: Desktop, Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rocclr-6.1.2-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-28 02:00:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2292870    
Bug Blocks:    
Attachments:
Description Flags
Output from rocm-clinfo none

Description g-man 2024-05-16 01:39:16 UTC
Since updating from Fedora 39 to Fedora 40, darktable-cltest rocm fails to compile for the AMD APU. It worked prior in Fedora 39 KDE. Attached is the error reported by darktable (darktable version 4.7.0~git1208.6bf26b3c). It seems like the path for opencl-c-base.h is not correctly reported. I checked and opencl-c-base.h is in /usr/lib/clang/17/include/ and also in /usr/lib/clang/18/include/

Output from darktable-cltest -d verbose
```
     0.4118 [opencl_build_program] could not build program: CL_BUILD_PROGRAM_FAILURE
     0.4118 [opencl_build_program] BUILD STATUS: -2
     0.4119 BUILD LOG:
     0.4119 fatal error: malformed or corrupted AST file: 'could not find file '/usr/lib64/llvm17/bin/../../../lib/clang/17/include/opencl-c-base.h' referenced by AST file '/tmp/comgr-c6b354/include/opencl1.2-c.pch''
1 error generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR).
```

I reported this issue at https://github.com/ROCm/llvm-project/issues/87 since it might be an known upstream problem. 

Others have reported a similar problem but I could not find a bug report in Bugzilla. https://discuss.pixls.us/t/opencl-on-fedora-40-with-rocm-amd-not-working/43378/1

Reproducible: Always

Steps to Reproduce:
1.On a system with AMD GPU and rocm-opencl and F40, execute darktable-cltest -d verbose
Actual Results:  
fatal error: malformed or corrupted AST file: 'could not find file '

While darktable does work on my system, it is an a reduced performance. 

Expected Results:  
darktable should be able to use the opencl drivers to compile the modules.

It compiled on F39. I also have an Nvidia GPU with rpmfusion drivers. Nvidia compiles without a problem on F39 and F40.


Operating System Fedora 40 KDE X11
AMD Ryzen 7 5700G with Radeon Graphics

Comment 1 g-man 2024-05-16 01:41:01 UTC
Created attachment 2033484 [details]
Output from rocm-clinfo

Comment 2 g-man 2024-05-29 00:56:17 UTC
It seems like it is cause by this: https://bugzilla.redhat.com/show_bug.cgi?id=2279335

Comment 3 Jeremy Newton 2024-07-04 16:46:14 UTC
We're going to just fix this with the update to 6.1

Comment 4 Fedora Update System 2024-07-12 00:58:54 UTC
FEDORA-2024-2a06d36b71 (hipblas-6.1.1-1.fc40, hipcub-6.1.1-2.fc40, and 24 more) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-2a06d36b71

Comment 5 Fedora Update System 2024-07-13 03:05:07 UTC
FEDORA-2024-2a06d36b71 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-2a06d36b71`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-2a06d36b71

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2024-07-28 02:00:22 UTC
FEDORA-2024-2a06d36b71 (hipblas-6.1.1-1.fc40, hipcub-6.1.1-2.fc40, and 24 more) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.