mirror of
https://github.com/amd/blis.git
synced 2026-06-29 18:57:23 +00:00
Formally registered thunderx2 subconfiguration.
Details: - Added a separate subconfiguration for thunderx2, which now uses different optimization flags than cortexa57/cortexa53.
This commit is contained in:
77
config/thunderx2/bli_cntx_init_thunderx2.c
Normal file
77
config/thunderx2/bli_cntx_init_thunderx2.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2014, The University of Texas at Austin
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "blis.h"
|
||||
|
||||
void bli_cntx_init_thunderx2( cntx_t* cntx )
|
||||
{
|
||||
blksz_t blkszs[ BLIS_NUM_BLKSZS ];
|
||||
|
||||
// Set default kernel blocksizes and functions.
|
||||
bli_cntx_init_thunderx2_ref( cntx );
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// Update the context with optimized native gemm micro-kernels and
|
||||
// their storage preferences.
|
||||
bli_cntx_set_l3_nat_ukrs
|
||||
(
|
||||
2,
|
||||
BLIS_GEMM_UKR, BLIS_FLOAT, bli_sgemm_armv8a_asm_8x12, FALSE,
|
||||
BLIS_GEMM_UKR, BLIS_DOUBLE, bli_dgemm_armv8a_asm_6x8, FALSE,
|
||||
cntx
|
||||
);
|
||||
|
||||
// Initialize level-3 blocksize objects with architecture-specific values.
|
||||
// s d c z
|
||||
bli_blksz_init_easy( &blkszs[ BLIS_MR ], 8, 6, -1, -1 );
|
||||
bli_blksz_init_easy( &blkszs[ BLIS_NR ], 12, 8, -1, -1 );
|
||||
bli_blksz_init_easy( &blkszs[ BLIS_MC ], 120, 120, -1, -1 );
|
||||
bli_blksz_init_easy( &blkszs[ BLIS_KC ], 640, 240, -1, -1 );
|
||||
bli_blksz_init_easy( &blkszs[ BLIS_NC ], 3072, 3072, -1, -1 );
|
||||
|
||||
// Update the context with the current architecture's register and cache
|
||||
// blocksizes (and multiples) for native execution.
|
||||
bli_cntx_set_blkszs
|
||||
(
|
||||
BLIS_NAT, 5,
|
||||
BLIS_NC, &blkszs[ BLIS_NC ], BLIS_NR,
|
||||
BLIS_KC, &blkszs[ BLIS_KC ], BLIS_KR,
|
||||
BLIS_MC, &blkszs[ BLIS_MC ], BLIS_MR,
|
||||
BLIS_NR, &blkszs[ BLIS_NR ], BLIS_NR,
|
||||
BLIS_MR, &blkszs[ BLIS_MR ], BLIS_MR,
|
||||
cntx
|
||||
);
|
||||
}
|
||||
|
||||
42
config/thunderx2/bli_family_thunderx2.h
Normal file
42
config/thunderx2/bli_family_thunderx2.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2014, The University of Texas at Austin
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
//#ifndef BLIS_FAMILY_H
|
||||
//#define BLIS_FAMILY_H
|
||||
|
||||
|
||||
// -- MEMORY ALLOCATION --------------------------------------------------------
|
||||
|
||||
#define BLIS_SIMD_ALIGN_SIZE 16
|
||||
|
||||
78
config/thunderx2/make_defs.mk
Normal file
78
config/thunderx2/make_defs.mk
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
#
|
||||
# BLIS
|
||||
# An object-based framework for developing high-performance BLAS-like
|
||||
# libraries.
|
||||
#
|
||||
# Copyright (C) 2014, The University of Texas at Austin
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# - Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
# Declare the name of the current configuration and add it to the
|
||||
# running list of configurations included by common.mk.
|
||||
THIS_CONFIG := thunderx2
|
||||
#CONFIGS_INCL += $(THIS_CONFIG)
|
||||
|
||||
#
|
||||
# --- Determine the C compiler and related flags ---
|
||||
#
|
||||
|
||||
# NOTE: The build system will append these variables with various
|
||||
# general-purpose/configuration-agnostic flags in common.mk. You
|
||||
# may specify additional flags here as needed.
|
||||
CPPROCFLAGS := -D_GNU_SOURCE
|
||||
CMISCFLAGS :=
|
||||
CPICFLAGS :=
|
||||
CWARNFLAGS :=
|
||||
|
||||
ifneq ($(DEBUG_TYPE),off)
|
||||
CDBGFLAGS := -g
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_TYPE),noopt)
|
||||
COPTFLAGS := -O0
|
||||
else
|
||||
COPTFLAGS := -O3 -ftree-vectorize -mtune=thunderx2t99
|
||||
endif
|
||||
|
||||
# Flags specific to optimized kernels.
|
||||
CKOPTFLAGS := $(COPTFLAGS)
|
||||
ifeq ($(CC_VENDOR),gcc)
|
||||
CKVECFLAGS := -march=armv8-a+fp+simd -mcpu=thunderx2t99
|
||||
else
|
||||
$(error gcc is required for this configuration.)
|
||||
endif
|
||||
|
||||
# Flags specific to reference kernels.
|
||||
CROPTFLAGS := $(CKOPTFLAGS)
|
||||
CRVECFLAGS := $(CKVECFLAGS)
|
||||
|
||||
# Store all of the variables here to new variables containing the
|
||||
# configuration name.
|
||||
$(eval $(call store-make-defs,$(THIS_CONFIG)))
|
||||
|
||||
@@ -31,6 +31,7 @@ piledriver: piledriver
|
||||
bulldozer: bulldozer
|
||||
|
||||
# ARM architectures.
|
||||
thunderx2: thunderx2/armv8a
|
||||
cortexa57: cortexa57/armv8a
|
||||
cortexa53: cortexa53/armv8a
|
||||
cortexa15: cortexa15/armv7a
|
||||
|
||||
@@ -120,6 +120,9 @@ void bli_arch_set_id( void )
|
||||
#endif
|
||||
|
||||
// ARM microarchitectures.
|
||||
#ifdef BLIS_FAMILY_THUNDERX2
|
||||
id = BLIS_ARCH_THUNDERX2;
|
||||
#endif
|
||||
#ifdef BLIS_FAMILY_CORTEXA57
|
||||
id = BLIS_ARCH_CORTEXA57;
|
||||
#endif
|
||||
@@ -171,6 +174,7 @@ static char* config_name[ BLIS_NUM_ARCHS ] =
|
||||
"piledriver",
|
||||
"bulldozer",
|
||||
|
||||
"thunderx2",
|
||||
"cortexa57",
|
||||
"cortexa53",
|
||||
"cortexa15",
|
||||
|
||||
@@ -390,6 +390,10 @@ arch_t bli_cpuid_query_id( void )
|
||||
{
|
||||
// Check for each ARMv8 configuration that is enabled, check for that
|
||||
// microarchitecture. We check from most recent to most dated.
|
||||
#ifdef BLIS_CONFIG_THUNDERX2
|
||||
if ( bli_cpuid_is_thunderx2( model, part, features ) )
|
||||
return BLIS_ARCH_THUNDERX2;
|
||||
#endif
|
||||
#ifdef BLIS_CONFIG_CORTEXA57
|
||||
if ( bli_cpuid_is_cortexa57( model, part, features ) )
|
||||
return BLIS_ARCH_CORTEXA57;
|
||||
@@ -423,6 +427,21 @@ arch_t bli_cpuid_query_id( void )
|
||||
return BLIS_ARCH_GENERIC;
|
||||
}
|
||||
|
||||
bool_t bli_cpuid_is_thunderx2
|
||||
(
|
||||
uint32_t family,
|
||||
uint32_t model,
|
||||
uint32_t features
|
||||
)
|
||||
{
|
||||
// Check for expected CPU features.
|
||||
const uint32_t expected = FEATURE_NEON;
|
||||
|
||||
if ( !bli_cpuid_has_features( features, expected ) ) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t bli_cpuid_is_cortexa57
|
||||
(
|
||||
uint32_t family,
|
||||
|
||||
@@ -67,6 +67,7 @@ bool_t bli_cpuid_is_piledriver( uint32_t family, uint32_t model, uint32_t feat
|
||||
bool_t bli_cpuid_is_bulldozer( uint32_t family, uint32_t model, uint32_t features );
|
||||
|
||||
// ARM
|
||||
bool_t bli_cpuid_is_thunderx2( uint32_t model, uint32_t part, uint32_t features );
|
||||
bool_t bli_cpuid_is_cortexa57( uint32_t model, uint32_t part, uint32_t features );
|
||||
bool_t bli_cpuid_is_cortexa53( uint32_t model, uint32_t part, uint32_t features );
|
||||
bool_t bli_cpuid_is_cortexa15( uint32_t model, uint32_t part, uint32_t features );
|
||||
|
||||
@@ -124,6 +124,11 @@ void bli_gks_init( void )
|
||||
#endif
|
||||
|
||||
// ARM architectures
|
||||
#ifdef BLIS_CONFIG_THUNDERX2
|
||||
bli_gks_register_cntx( BLIS_ARCH_THUNDERX2, bli_cntx_init_thunderx2,
|
||||
bli_cntx_init_thunderx2_ref,
|
||||
bli_cntx_init_thunderx2_ind );
|
||||
#endif
|
||||
#ifdef BLIS_CONFIG_CORTEXA57
|
||||
bli_gks_register_cntx( BLIS_ARCH_CORTEXA57, bli_cntx_init_cortexa57,
|
||||
bli_cntx_init_cortexa57_ref,
|
||||
|
||||
@@ -80,6 +80,9 @@ CNTX_INIT_PROTS( bulldozer )
|
||||
|
||||
// -- ARM architectures --
|
||||
|
||||
#ifdef BLIS_CONFIG_THUNDERX2
|
||||
CNTX_INIT_PROTS( thunderx2 )
|
||||
#endif
|
||||
#ifdef BLIS_CONFIG_CORTEXA57
|
||||
CNTX_INIT_PROTS( cortexa57 )
|
||||
#endif
|
||||
|
||||
@@ -900,6 +900,7 @@ typedef enum
|
||||
BLIS_ARCH_BULLDOZER,
|
||||
|
||||
// ARM
|
||||
BLIS_ARCH_THUNDERX2,
|
||||
BLIS_ARCH_CORTEXA57,
|
||||
BLIS_ARCH_CORTEXA53,
|
||||
BLIS_ARCH_CORTEXA15,
|
||||
@@ -914,7 +915,7 @@ typedef enum
|
||||
|
||||
} arch_t;
|
||||
|
||||
#define BLIS_NUM_ARCHS 18
|
||||
#define BLIS_NUM_ARCHS 19
|
||||
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user