diff --git a/src/bin/runcpu.ts b/src/bin/runcpu.ts index cd43078..a3387a3 100644 --- a/src/bin/runcpu.ts +++ b/src/bin/runcpu.ts @@ -29,6 +29,15 @@ const argv = await yargs(hideBin(process.argv)) choices: ['test', 'train', 'ref'], default: 'ref', }) + .option('optimize-profile', { + type: 'string', + choices: ['O2', 'base'], + demandOption: true, + }) + .option('allow-misaligned', { + type: 'boolean', + default: false, + }) .option('spec', { alias: 's', type: 'string', @@ -90,7 +99,7 @@ const uuid = crypto.randomUUID(); const prefix = path.resolve(argv.compilerPrefix); -const o3LTOFlags = [ +const baseFlags = [ "-O3", "-flto", "-fuse-ld=lld", @@ -109,7 +118,8 @@ const specProc = await spawnSPECWithID( spec, { optimize: [ - "-O2", + ...argv.optimizeProfile === "O2" ? ["-O2"] : baseFlags, + ...argv.allowMisaligned ? unalignedFlags : [], ...sw64TargetOptions({ simd: argv.simd }), ...argv.compilerSuite == "llvm" ? [sunway.mcpu(sunwayGeneration)] : [], // Only add -mcpu for llvm ],