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

AMX extension #68

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
95f1c83
[ADD] AMX implementation and Sapphire rapids config
cyssi-cb Sep 20, 2024
1fdf36f
[FIX] update asmjit calls
cyssi-cb Sep 20, 2024
2b9adf9
[FIX] include Sapphire Rapids config
cyssi-cb Sep 20, 2024
a91ea44
[FIX] asmjit call in sapphire rapids config
cyssi-cb Sep 20, 2024
e2a8731
[FIX] add new files to cmake
cyssi-cb Sep 20, 2024
529bb7f
[FIX] adapted workload to new asmjit api
cyssi-cb Sep 20, 2024
b3b94f8
[FIX] adapted workload to new asmjit api
cyssi-cb Sep 20, 2024
8e8e82d
[FIX] add missing compiler flags
cyssi-cb Sep 20, 2024
892f234
[FIX] register SApphire Rapids config
cyssi-cb Sep 20, 2024
5c5f935
[REMOVED] unneded prints
cyssi-cb Sep 20, 2024
edf806c
[ADD] use bf16
cyssi-cb Sep 20, 2024
af302d6
[FIX] typo
cyssi-cb Sep 20, 2024
7caf6cb
[ADD] limit init value
cyssi-cb Sep 23, 2024
38fe61d
[REMOVED] unnecessary defines
cyssi-cb Sep 23, 2024
0427834
[ADD] use AVX512 config with AMX
cyssi-cb Sep 23, 2024
9fc69b6
[FIX] correct CPUID model, function as static, logging behavior
cyssi-cb Nov 18, 2024
b5fa958
[FIX] includes
cyssi-cb Nov 18, 2024
fb60acd
[FIX] includes
cyssi-cb Nov 18, 2024
5576797
[ADD] check for AMX during compilePayload
cyssi-cb Nov 18, 2024
ee707cf
[FIX] spelling
cyssi-cb Nov 18, 2024
6e66d26
[FIX] merge AMX into AVX512 workload with runtime check for AMX feature
cyssi-cb Nov 18, 2024
824520c
[FIX] CMakeLists
cyssi-cb Nov 18, 2024
87d6af9
[FIX] naming convention
cyssi-cb Nov 18, 2024
b775b8c
[FIX] spelling
cyssi-cb Nov 18, 2024
ce86848
[FIX] spelling
cyssi-cb Nov 18, 2024
3a789bf
[FIX] spelling
cyssi-cb Nov 18, 2024
83e91eb
[REMOVE] unnecesary payload definition, now merged into AVX512Payload…
cyssi-cb Nov 18, 2024
fdf01db
Merge branch 'master' into amx
cyssi-cb Nov 18, 2024
ce35b28
[FIX] Cmake
cyssi-cb Nov 18, 2024
b1577ce
[FIX] move __tilecfg definition into header
cyssi-cb Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ git_submodule_update()

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2 -fdata-sections -ffunction-sections")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mamx-int8 -mamx-tile -Wall -Wextra -O2 -fdata-sections -ffunction-sections")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-mamx-tile is necessary.
-mamx-int8 got removed.

endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
Expand Down
58 changes: 58 additions & 0 deletions include/firestarter/Environment/X86/Payload/AVX512_AMX_Payload.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: [email protected]
*****************************************************************************/

#pragma once

#include <firestarter/Environment/X86/Payload/X86Payload.hpp>

namespace firestarter::environment::x86::payload {
class AVX512_AMX_Payload final : public X86Payload {
public:
AVX512_AMX_Payload(asmjit::CpuFeatures const &supportedFeatures)
: X86Payload(supportedFeatures, {asmjit::CpuFeatures::X86::kAMX_BF16},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for the kAMX_BF16 feature may have prevented you from integrating the AMX code it into the AVX512 payload. Can we check this feature if the "AMX" meta-instruction is selection during the compilePayload step instead?

"AVX512_AMX", 8, 32) {}

int compilePayload(
std::vector<std::pair<std::string, unsigned>> const &proportion,
unsigned instructionCacheSize,
std::list<unsigned> const &dataCacheBufferSize, unsigned ramBufferSize,
unsigned thread, unsigned numberOfLines, bool dumpRegisters,
bool errorDetection) override;
std::list<std::string> getAvailableInstructions() const override;
void init(unsigned long long *memoryAddr,
unsigned long long bufferSize) override;

firestarter::environment::payload::Payload *clone() const override {
return new AVX512_AMX_Payload(this->supportedFeatures());
};

private:
const std::map<std::string, unsigned> instructionFlops = {
{"REG", 32}, {"L1_L", 32}, {"L1_BROADCAST", 16}, {"L1_S", 16},
{"L1_LS", 16}, {"L2_L", 32}, {"L2_S", 16}, {"L2_LS", 16},
{"L3_L", 32}, {"L3_S", 16}, {"L3_LS", 16}, {"L3_P", 16},
{"RAM_L", 32}, {"RAM_S", 16}, {"RAM_LS", 16}, {"RAM_P", 16},
{"AMX", 512}};

const std::map<std::string, unsigned> instructionMemory = {
{"RAM_L", 64}, {"RAM_S", 128}, {"RAM_LS", 128}, {"RAM_P", 64}};
};
} // namespace firestarter::environment::x86::payload
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2020 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: [email protected]
*****************************************************************************/

#pragma once

#include <firestarter/Environment/X86/Payload/AVX512_AMX_Payload.hpp>
#include <firestarter/Environment/X86/Platform/X86PlatformConfig.hpp>

namespace firestarter::environment::x86::platform {
class SapphireRapidsConfig final : public X86PlatformConfig {

public:
SapphireRapidsConfig(asmjit::CpuFeatures const &supportedFeatures,
unsigned family, unsigned model, unsigned threads)
: X86PlatformConfig("SKL_XEONEP", 6, {85}, {1, 2}, 0,
marenz2569 marked this conversation as resolved.
Show resolved Hide resolved
{32768, 1048576, 1441792}, 1048576000, 1536, family,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these values also have not been updated

model, threads,
new payload::AVX512_AMX_Payload(supportedFeatures)) {}

std::vector<std::pair<std::string, unsigned>>
getDefaultPayloadSettings() const override {
return std::vector<std::pair<std::string, unsigned>>({{"RAM_S", 3},
{"RAM_P", 1},
{"L3_S", 1},
{"L3_P", 1},
{"L2_S", 4},
{"L2_L", 70},
{"L1_S", 0},
{"L1_L", 40},
{"REG", 140},
{"AMX", 1}});
}
};
} // namespace firestarter::environment::x86::platform
5 changes: 4 additions & 1 deletion include/firestarter/Environment/X86/X86Environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <firestarter/Environment/Environment.hpp>
#include <firestarter/Environment/X86/X86CPUTopology.hpp>

#include <firestarter/Environment/X86/Platform/SapphireRapidsConfig.hpp>
#include <firestarter/Environment/X86/Platform/BulldozerConfig.hpp>
#include <firestarter/Environment/X86/Platform/HaswellConfig.hpp>
#include <firestarter/Environment/X86/Platform/HaswellEPConfig.hpp>
Expand Down Expand Up @@ -88,14 +89,16 @@ class X86Environment final : public Environment {
REGISTER(HaswellEPConfig), REGISTER(SandyBridgeConfig),
REGISTER(SandyBridgeEPConfig), REGISTER(NehalemConfig),
REGISTER(NehalemEPConfig), REGISTER(BulldozerConfig),
REGISTER(NaplesConfig), REGISTER(RomeConfig)};
REGISTER(NaplesConfig), REGISTER(RomeConfig),
REGISTER(SapphireRapidsConfig)};

std::list<platform::X86PlatformConfig *> platformConfigs;

// List of fallback PlatformConfig. Add one for each x86 extension.
const std::list<std::function<platform::X86PlatformConfig *(
asmjit::CpuFeatures const &, unsigned, unsigned, unsigned)>>
fallbackPlatformConfigsCtor = {
REGISTER(SapphireRapidsConfig), // AMX + AVX512
REGISTER(SkylakeSPConfig), // AVX512
REGISTER(BulldozerConfig), // FMA4
REGISTER(HaswellConfig), // FMA
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SET(FIRESTARTER_FILES

firestarter/Environment/X86/Payload/X86Payload.cpp
firestarter/Environment/X86/Payload/AVX512Payload.cpp
firestarter/Environment/X86/Payload/AVX512_AMX_Payload.cpp
firestarter/Environment/X86/Payload/FMA4Payload.cpp
firestarter/Environment/X86/Payload/FMAPayload.cpp
firestarter/Environment/X86/Payload/ZENFMAPayload.cpp
Expand Down
Loading
Loading