Skip to content

Commit

Permalink
Update configurations to be consistent with confs on Golem
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Aug 16, 2023
1 parent c404792 commit d2569eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
7 changes: 4 additions & 3 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
- Compile benchmarks with `./tool/compile_benchmarks.dart --target=<target>`
where `<target>` is one of:

- `wasm`: Doesn't run any optimizations
- `wasm-opt`: Runs binaryen optimizations
- `wasm`: Default optimized build
- `wasm-omit-checks`: Optimized build with `--omit-checks`

- Run with: `$DART_SDK/bin/run_dart2wasm_d8 out/from_binary.wasm`, or use
`.opt.wasm` extension for the `wasm-opt` target: `from_binary.opt.wasm`.
`.omit-checks.wasm` extension for the `wasm-omit-checks` target:
`from_binary.omit-checks.wasm`.

[1]: https://github.com/dart-lang/sdk/wiki/Building
[2]: https://github.com/dart-lang/sdk/tree/main/sdk
Expand Down
26 changes: 16 additions & 10 deletions benchmarks/tool/compile_benchmarks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ Future<void> main(List<String> args) async {
targets.add(wasmTarget);
break;

case 'wasm-opt':
targets.add(wasmOptTarget);
case 'wasm-omit-checks':
targets.add(wasmOmitChecksTarget);
break;

default:
print(
'Unsupported target: $targetStr. Supported targets: aot, exe, jit, js, js-production');
print('Unsupported target: $targetStr. Supported targets: aot, exe, '
'jit, js, js-production, wasm, wasm-omit-checks');
exit(1);
}
}
Expand Down Expand Up @@ -145,7 +145,8 @@ const jitTarget = Target('jit', jitProcessArgs);
const jsTarget = Target('js', jsProcessArgs);
const jsProductionTarget = Target('js-production', jsProductionProcessArgs);
const wasmTarget = Target('wasm', wasmProcessArgs);
const wasmOptTarget = Target('wasm-opt', wasmOptProcessArgs);
const wasmOmitChecksTarget =
Target('wasm-omit-checks', wasmOmitChecksProcessArgs);

List<String> aotProcessArgs(String sourceFile) {
final baseName = path.basename(sourceFile);
Expand Down Expand Up @@ -200,23 +201,28 @@ List<String> jsProductionProcessArgs(String sourceFile) {
List<String> wasmProcessArgs(String sourceFile) {
final sdkPath = Platform.environment['DART_SDK'];
if (sdkPath == null) {
throw '\$DART_SDK environment variable not set';
throw '\$DART_SDK environment variable is not set';
}
final baseName = path.basename(sourceFile);
final baseNameNoExt = path.withoutExtension(baseName);
return ['$sdkPath/bin/dart2wasm', sourceFile, 'out/$baseNameNoExt.wasm'];
return [
'$sdkPath/../pkg/dart2wasm/tool/compile_benchmark',
sourceFile,
'out/$baseNameNoExt.wasm',
];
}

List<String> wasmOptProcessArgs(String sourceFile) {
List<String> wasmOmitChecksProcessArgs(String sourceFile) {
final sdkPath = Platform.environment['DART_SDK'];
if (sdkPath == null) {
throw '\$DART_SDK environment variable not set';
throw '\$DART_SDK environment variable is not set';
}
final baseName = path.basename(sourceFile);
final baseNameNoExt = path.withoutExtension(baseName);
return [
'$sdkPath/../pkg/dart2wasm/tool/compile_benchmark',
sourceFile,
'out/$baseNameNoExt.opt.wasm',
'out/$baseNameNoExt.omit-checks.wasm',
'--omit-checks',
];
}

0 comments on commit d2569eb

Please sign in to comment.