bin/spec: support "special flags"
This commit is contained in:
@@ -96,6 +96,8 @@ default: # data model applies to all benchmarks
|
|||||||
CPORTABILITY = -DSPEC_CASE_FLAG
|
CPORTABILITY = -DSPEC_CASE_FLAG
|
||||||
FPORTABILITY = -Mbyteswapio
|
FPORTABILITY = -Mbyteswapio
|
||||||
|
|
||||||
|
@@SpecialFlags@@
|
||||||
|
|
||||||
|
|
||||||
%if %{bits} == 32
|
%if %{bits} == 32
|
||||||
intspeed,fpspeed:
|
intspeed,fpspeed:
|
||||||
|
|||||||
@@ -94,36 +94,58 @@ const uuid = crypto.randomUUID();
|
|||||||
|
|
||||||
const prefix = path.resolve(argv.compilerPrefix);
|
const prefix = path.resolve(argv.compilerPrefix);
|
||||||
|
|
||||||
const baseFlags = [
|
const optimizeProfiles = {
|
||||||
|
base: [
|
||||||
"-O3",
|
"-O3",
|
||||||
"-flto",
|
"-flto=thin",
|
||||||
"-fuse-ld=lld",
|
],
|
||||||
...argv.simd ? ["-Wl,-plugin-opt,--mattr=simd"] : [],
|
O2: [
|
||||||
];
|
"-O2",
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
const unalignedFlags = [
|
|
||||||
"-mllvm",
|
|
||||||
"-sw64-allows-misaligned-memory-accesses",
|
|
||||||
];
|
|
||||||
|
|
||||||
|
const optimizeFlags = optimizeProfiles[argv.optimizeProfile as (keyof (typeof optimizeProfiles))];
|
||||||
|
|
||||||
const spec = mkSPEC(path.resolve(argv.spec));
|
const spec = mkSPEC(path.resolve(argv.spec));
|
||||||
|
const sw64UnalignedFlag = "-sw64-allows-misaligned-memory-accesses";
|
||||||
|
|
||||||
|
function getSpecialFlags() {
|
||||||
|
if (argv.optimizeProfile === "base") {
|
||||||
|
return [
|
||||||
|
"648.exchange2_s:",
|
||||||
|
" EXTRA_OPTIMIZE = -mllvm -enable-ipsccp-pass",
|
||||||
|
" EXTRA_LDFLAGS = -Wl,-mllvm,-enable-ipsccp-pass",
|
||||||
|
].join("\n");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
const specProc = await spawnSPECWithID(
|
const specProc = await spawnSPECWithID(
|
||||||
spec,
|
spec,
|
||||||
{
|
{
|
||||||
optimize: [
|
optimize: [
|
||||||
...argv.optimizeProfile === "O2" ? ["-O2"] : baseFlags,
|
...optimizeFlags,
|
||||||
...argv.allowMisaligned ? unalignedFlags : [],
|
...argv.allowMisaligned ? ["-mllvm", sw64UnalignedFlag] : [],
|
||||||
...sw64TargetOptions({ simd: argv.simd }),
|
...sw64TargetOptions({ simd: argv.simd }),
|
||||||
|
...["--sysroot", "/usr/sw/swgcc1030_native_tools"],
|
||||||
...argv.compilerSuite == "llvm" ? [sunway.mcpu(sunwayGeneration)] : [], // Only add -mcpu for llvm
|
...argv.compilerSuite == "llvm" ? [sunway.mcpu(sunwayGeneration)] : [], // Only add -mcpu for llvm
|
||||||
],
|
],
|
||||||
ldflags: [
|
ldflags: [
|
||||||
'-static',
|
'-static',
|
||||||
`-L${path.resolve(prefix, 'lib')}`,
|
`-L${path.resolve(prefix, 'lib')}`,
|
||||||
|
...optimizeFlags,
|
||||||
|
"-fuse-ld=lld",
|
||||||
|
...["--sysroot", "/usr/sw/swgcc1030_native_tools"],
|
||||||
|
...argv.optimizeProfile === "base" ? [
|
||||||
|
...argv.simd ? ["-Wl,-plugin-opt,-mattr=+simd"] : [],
|
||||||
|
...argv.allowMisaligned ? [`-Wl,-plugin-opt,${sw64UnalignedFlag}`] : [],
|
||||||
|
...sunwayGeneration === "8a" ? ["-Wl,-plugin-opt,-mattr=+core4"] : [],
|
||||||
|
] : [],
|
||||||
],
|
],
|
||||||
compilerPaths: toolchain(argv.compilerPrefix, argv.compilerSuite as ToolchainSuite),
|
compilerPaths: toolchain(argv.compilerPrefix, argv.compilerSuite as ToolchainSuite),
|
||||||
libs: argv.compilerSuite === "llvm" ? cflangLibs(prefix) : [],
|
libs: argv.compilerSuite === "llvm" ? cflangLibs(prefix) : [],
|
||||||
|
specialFlags: getSpecialFlags(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setprocgroup: true,
|
setprocgroup: true,
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export interface ConfigOptions {
|
|||||||
CC: string,
|
CC: string,
|
||||||
FC: string,
|
FC: string,
|
||||||
};
|
};
|
||||||
|
specialFlags: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pure function to render configuration
|
// Pure function to render configuration
|
||||||
@@ -81,6 +82,7 @@ export const renderConfig = (options: ConfigOptions): string => {
|
|||||||
.replace("@@CompilerCXX@@", options.compilerPaths.CXX)
|
.replace("@@CompilerCXX@@", options.compilerPaths.CXX)
|
||||||
.replace("@@CompilerFC@@", options.compilerPaths.FC)
|
.replace("@@CompilerFC@@", options.compilerPaths.FC)
|
||||||
.replace("@@LIBS@@", options.libs.join(" "))
|
.replace("@@LIBS@@", options.libs.join(" "))
|
||||||
|
.replace("@@SpecialFlags@@", options.specialFlags)
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user