Skip to content

Commit

Permalink
Fix BLIS build on PPC
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jul 7, 2022
1 parent bdea711 commit 5e50cd1
Show file tree
Hide file tree
Showing 12 changed files with 239 additions and 6 deletions.
3 changes: 3 additions & 0 deletions easybuild/easyconfigs/b/BLIS/BLIS-0.8.1-GCC-10.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ toolchain = {'name': 'GCC', 'version': '10.3.0'}
source_urls = ['https://github.com/flame/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-%(version)s_enable_ppc_autodetect.patch',
'%(name)s-%(version)s_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'729694128719801e82fae7b5f2489ab73e4a467f46271beff09588c9265a697b', # 0.8.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]
Expand Down
3 changes: 3 additions & 0 deletions easybuild/easyconfigs/b/BLIS/BLIS-0.8.1-GCC-11.2.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ toolchain = {'name': 'GCC', 'version': '11.2.0'}
source_urls = ['https://github.com/flame/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-%(version)s_enable_ppc_autodetect.patch',
'%(name)s-%(version)s_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'729694128719801e82fae7b5f2489ab73e4a467f46271beff09588c9265a697b', # 0.8.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]
Expand Down
3 changes: 3 additions & 0 deletions easybuild/easyconfigs/b/BLIS/BLIS-0.8.1-GCCcore-10.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ toolchain = {'name': 'GCCcore', 'version': '10.3.0'}
source_urls = ['https://github.com/flame/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-%(version)s_enable_ppc_autodetect.patch',
'%(name)s-%(version)s_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'729694128719801e82fae7b5f2489ab73e4a467f46271beff09588c9265a697b', # 0.8.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Add autodetection for POWER7, POWER9 & POWER10
See https://github.com/amd/blis/pull/6

Author: Alexander Grund (TU Dresden)
diff -aur a/frame/base/bli_cpuid.c b/frame/base/bli_cpuid.c
--- a/frame/base/bli_cpuid.c 2021-03-22 23:42:33.000000000 +0100
+++ b/frame/base/bli_cpuid.c 2022-07-07 14:05:13.627541000 +0200
@@ -429,7 +429,7 @@
return TRUE;
}

-#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
+#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

arch_t bli_cpuid_query_id( void )
{
@@ -484,9 +484,14 @@
return BLIS_ARCH_GENERIC;
}
}
- else if ( vendor == VENDOR_UNKNOWN )
+ else if ( vendor == VENDOR_IBM )
{
- return BLIS_ARCH_GENERIC;
+ if ( model == MODEL_POWER7)
+ return BLIS_ARCH_POWER7;
+ else if ( model == MODEL_POWER9)
+ return BLIS_ARCH_POWER9;
+ else if ( model == MODEL_POWER10)
+ return BLIS_ARCH_POWER10;
}

return BLIS_ARCH_GENERIC;
@@ -985,7 +990,7 @@
}
}

-#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
+#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

#define TEMP_BUFFER_SIZE 200

@@ -1007,6 +1012,20 @@
char feat_str[ TEMP_BUFFER_SIZE ];
char* r_val;

+#ifdef _ARCH_PPC
+ r_val = find_string_in( "cpu", proc_str, TEMP_BUFFER_SIZE, pci_str );
+ if ( r_val == NULL ) return VENDOR_IBM;
+
+ if ( strstr( proc_str, "POWER7" ) != NULL )
+ *model = MODEL_POWER7;
+ else if ( strstr( proc_str, "POWER9" ) != NULL )
+ *model = MODEL_POWER9;
+ else if ( strstr( proc_str, "POWER10" ) != NULL )
+ *model = MODEL_POWER10;
+
+ return VENDOR_IBM;
+#endif
+
//printf( "bli_cpuid_query(): beginning search\n" );

// Search /proc/cpuinfo for the 'Processor' entry.
diff -aur a/frame/base/bli_cpuid.h b/frame/base/bli_cpuid.h
--- a/frame/base/bli_cpuid.h 2021-03-22 23:42:33.000000000 +0100
+++ b/frame/base/bli_cpuid.h 2022-07-07 13:59:51.620586000 +0200
@@ -158,19 +158,23 @@
FEATURE_AVX512VL = 0x4000
};

-#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
+#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

char* find_string_in( char* target, char* buffer, size_t buf_len, char* filepath );

enum
{
VENDOR_ARM = 0,
+ VENDOR_IBM,
VENDOR_UNKNOWN
};
enum
{
MODEL_ARMV7 = 0,
MODEL_ARMV8,
+ MODEL_POWER7,
+ MODEL_POWER9,
+ MODEL_POWER10,
MODEL_UNKNOWN
};
enum
8 changes: 6 additions & 2 deletions easybuild/easyconfigs/b/BLIS/BLIS-0.9.0-GCC-11.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ toolchain = {'name': 'GCC', 'version': '11.3.0'}

source_urls = ['https://github.com/flame/blis/archive/']
sources = ['%(version)s.tar.gz']
checksums = ['1135f664be7355427b91025075562805cdc6cc730d3173f83533b2c5dcc2f308']

patches = ['%(name)s-%(version)s_enable_ppc_autodetect.patch']
checksums = [
'1135f664be7355427b91025075562805cdc6cc730d3173f83533b2c5dcc2f308', # 0.9.0.tar.gz
# BLIS-0.9.0_enable_ppc_autodetect.patch
'f373fb252c0d14036fb631f048091976cceb02abb3e570a97fbaeac2fbb12328',
]
builddependencies = [
('Python', '3.10.4', '-bare'),
('Perl', '5.34.1'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Add autodetection for POWER7, POWER9 & POWER10
See https://github.com/amd/blis/pull/6

Author: Alexander Grund (TU Dresden)
diff -ur a/frame/base/bli_cpuid.c b/frame/base/bli_cpuid.c
--- a/frame/base/bli_cpuid.c 2022-04-01 15:12:06.000000000 +0200
+++ b/frame/base/bli_cpuid.c 2022-07-07 16:15:43.724020000 +0200
@@ -485,7 +485,7 @@
return TRUE;
}

-#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
+#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

arch_t bli_cpuid_query_id( void )
{
@@ -530,9 +530,14 @@
return BLIS_ARCH_GENERIC;
}
}
- else if ( vendor == VENDOR_UNKNOWN )
+ else if ( vendor == VENDOR_IBM )
{
- return BLIS_ARCH_GENERIC;
+ if ( model == MODEL_POWER7)
+ return BLIS_ARCH_POWER7;
+ else if ( model == MODEL_POWER9)
+ return BLIS_ARCH_POWER9;
+ else if ( model == MODEL_POWER10)
+ return BLIS_ARCH_POWER10;
}

return BLIS_ARCH_GENERIC;
@@ -1203,7 +1208,7 @@
return VENDOR_ARM;
}

-#elif defined(__arm__) || defined(_M_ARM)
+#elif defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

/*
I can't easily find documentation to do this as for aarch64, though
@@ -1240,6 +1245,20 @@
char feat_str[ TEMP_BUFFER_SIZE ];
char* r_val;

+#ifdef _ARCH_PPC
+ r_val = find_string_in( "cpu", proc_str, TEMP_BUFFER_SIZE, pci_str );
+ if ( r_val == NULL ) return VENDOR_IBM;
+
+ if ( strstr( proc_str, "POWER7" ) != NULL )
+ *model = MODEL_POWER7;
+ else if ( strstr( proc_str, "POWER9" ) != NULL )
+ *model = MODEL_POWER9;
+ else if ( strstr( proc_str, "POWER10" ) != NULL )
+ *model = MODEL_POWER10;
+
+ return VENDOR_IBM;
+#endif
+
//printf( "bli_cpuid_query(): beginning search\n" );

// Search /proc/cpuinfo for the 'Processor' entry.
diff -ur a/frame/base/bli_cpuid.h b/frame/base/bli_cpuid.h
--- a/frame/base/bli_cpuid.h 2022-04-01 15:12:06.000000000 +0200
+++ b/frame/base/bli_cpuid.h 2022-07-07 16:09:22.617023000 +0200
@@ -161,19 +161,23 @@
FEATURE_AVX512VL = 0x4000
};

-#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
+#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

char* find_string_in( char* target, char* buffer, size_t buf_len, char* filepath );

enum
{
VENDOR_ARM = 0,
+ VENDOR_IBM,
VENDOR_UNKNOWN
};
enum
{
MODEL_ARMV7 = 0,
MODEL_ARMV8,
+ MODEL_POWER7,
+ MODEL_POWER9,
+ MODEL_POWER10,
MODEL_UNKNOWN
};
enum
7 changes: 6 additions & 1 deletion easybuild/easyconfigs/b/BLIS/BLIS-2.2-GCCcore-9.3.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ toolchain = {'name': 'GCCcore', 'version': '9.3.0'}

source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = ['BLIS-2.2-amd_fix-undefined-reference-blist-abort.patch']
patches = [
'BLIS-2.2-amd_fix-undefined-reference-blist-abort.patch',
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
]
checksums = [
'e1feb60ac919cf6d233c43c424f6a8a11eab2c62c2c6e3f2652c15ee9063c0c9', # 2.2.tar.gz
# BLIS-2.2-amd_fix-undefined-reference-blist-abort.patch
'e879bd79e4438f7e6905461af1d483d27d14945eb9e75509b22c7584b8ba93c4',
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
]

builddependencies = [
Expand Down
8 changes: 8 additions & 0 deletions easybuild/easyconfigs/b/BLIS/BLIS-3.0-GCCcore-10.3.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ toolchain = {'name': 'GCCcore', 'version': '10.3.0'}

source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
'%(name)s-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'ac848c040cd6c3550fe49148dbdf109216cad72d3235763ee7ee8134e1528517', # 3.0.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]

builddependencies = [
Expand Down
3 changes: 3 additions & 0 deletions easybuild/easyconfigs/b/BLIS/BLIS-3.0.1-GCC-11.2.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ toolchain = {'name': 'GCC', 'version': '11.2.0'}
source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
'%(name)s-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e', # 3.0.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]
Expand Down
12 changes: 11 additions & 1 deletion easybuild/easyconfigs/b/BLIS/BLIS-3.0.1-GCCcore-10.2.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ toolchain = {'name': 'GCCcore', 'version': '10.2.0'}

source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
checksums = ['dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e']
patches = [
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
'%(name)s-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e', # 3.0.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]

builddependencies = [
('binutils', '2.35'),
Expand Down
12 changes: 11 additions & 1 deletion easybuild/easyconfigs/b/BLIS/BLIS-3.0.1-GCCcore-10.3.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ toolchain = {'name': 'GCCcore', 'version': '10.3.0'}

source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
checksums = ['dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e']
patches = [
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
'%(name)s-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'dff643e6ef946846e91e8f81b75ff8fe21f1f2d227599aecd654d184d9beff3e', # 3.0.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]

builddependencies = [
('binutils', '2.36.1'),
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/b/BLIS/BLIS-3.1-GCCcore-11.2.0-amd.eb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
source_urls = ['https://github.com/amd/blis/archive/']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-0.8.1_enable_ppc_autodetect.patch',
'%(name)s-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch',
]
checksums = [
'2891948925b9db99eec02a1917d9887a7bee9ad2afc5421c9ba58602a620f2bf', # 3.1.tar.gz
# BLIS-0.8.1_enable_ppc_autodetect.patch
'b8a3d564a8d4f205e70241765ddfd28331c3c12355ef9c44172c9a0cab9f0111',
# BLIS-0.8.1_fix_dgemm-fpe-signalling-on-broadwell.patch
'345fa39933e9d1442d2eb1e4ed9129df3fe4aefecf4d104e5d4f25b3bca24d0d',
]

builddependencies = [
('binutils', '2.37'),
('Python', '3.9.6'),
Expand Down

0 comments on commit 5e50cd1

Please sign in to comment.