Bug 2395835

Summary: onednn build enforces power10 -mmma
Product: [Fedora] Fedora Reporter: Nicolas Chauvet (kwizart) <kwizart>
Component: onednnAssignee: Nicolas Chauvet (kwizart) <kwizart>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: aekoroglu, ajax, dan, kwizart
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
URL: https://github.com/uxlfoundation/oneDNN/issues/3749
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-09-22 11:32:35 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:    
Bug Blocks: 1071880    

Description Nicolas Chauvet (kwizart) 2025-09-16 16:09:48 UTC
The current workaround is to rely on power10 and -mmma by default for the ppc64le build.

Reproducible: Always

Comment 1 Nicolas Chauvet (kwizart) 2025-09-16 16:10:35 UTC
Upstream report https://github.com/uxlfoundation/oneDNN/issues/3749

Comment 2 Dan Horák 2025-09-17 09:23:23 UTC
something like this might be an upstreamable fix after some coding style updates

diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt
index 10504d1a34..c7b46144ba 100644
--- a/src/cpu/CMakeLists.txt
+++ b/src/cpu/CMakeLists.txt
@@ -40,6 +40,16 @@ if((DNNL_TARGET_ARCH STREQUAL "X64") OR (DNNL_TARGET_ARCH STREQUAL "AARCH64"))
 endif()
 
 if(DNNL_TARGET_ARCH STREQUAL "PPC64")
+    include(CheckSourceCompiles)
+
+    check_source_compiles(C [[
+      #if !defined(__MMA__)
+      #  error "No MMA available"
+      #endif
+      int main(void) { return 0; }
+    ]] HAVE_PPC64_MMA)
+    if(HAVE_PPC64_MMA)
+    add_definitions_with_host_compiler(-DHAVE_PPC64_MMA=1)
     file(GLOB FILES_REQUIRED_OPT
         ${CMAKE_CURRENT_SOURCE_DIR}/gemm/*.[ch]pp
     )
@@ -47,6 +57,7 @@ if(DNNL_TARGET_ARCH STREQUAL "PPC64")
         set_source_files_properties(${FILES_REQUIRED_OPT}
             PROPERTIES COMPILE_FLAGS "-O3 -funroll-loops")
     endif()
+    endif()
 endif()
 
 if(NOT DNNL_ENABLE_JIT_PROFILING)
@@ -139,7 +150,9 @@ if (DNNL_TARGET_ARCH STREQUAL "AARCH64")
     add_subdirectory(aarch64)
 endif()
 if (DNNL_TARGET_ARCH STREQUAL "PPC64")
+    if(HAVE_PPC64_MMA)
     add_subdirectory(ppc64)
+    endif()
 endif()
 if (DNNL_TARGET_ARCH STREQUAL "S390X")
     add_subdirectory(s390x)
diff --git a/src/cpu/reorder/cpu_reorder_regular_f32_u8.cpp b/src/cpu/reorder/cpu_reorder_regular_f32_u8.cpp
index 264168500a..b53337e74c 100644
--- a/src/cpu/reorder/cpu_reorder_regular_f32_u8.cpp
+++ b/src/cpu/reorder/cpu_reorder_regular_f32_u8.cpp
@@ -36,7 +36,9 @@ const impl_list_map_t &regular_f32_u8_impl_list_map() {
             DNNL_AARCH64_ONLY(CPU_REORDER_INSTANCE(aarch64::jit_blk_reorder_t))
             DNNL_AARCH64_ONLY(CPU_REORDER_INSTANCE(aarch64::jit_uni_reorder_t))
 
+#ifdef HAVE_PPC64_MMA
            DNNL_PPC64_ONLY(CPU_REORDER_INSTANCE(ppc64::ppc64_matrixA_reorder_t))
+#endif
 
            REG_FAST_DIRECT_COPY(f32, u8)

Comment 3 Dan Horák 2025-09-17 09:50:10 UTC
BTW the C/C++ standard level settings from the spec are ignored, see in build.logs

CMake Warning:
  Manually-specified variables were not used by the project:
    CMAKE_CPP_STD
    CMAKE_C_STD

Comment 4 Dan Horák 2025-09-17 16:45:27 UTC
opened a PR upstream

Comment 5 Nicolas Chauvet (kwizart) 2025-09-22 11:32:35 UTC
Thanks for the Fix and help provided.