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

Non-JVM benchmarks fail if multiple modes are specified in BenchmarkMode annotation #174

Open
fzhinkin opened this issue Dec 19, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@fzhinkin
Copy link
Contributor

BenchmarkMode annotation allows specifying multiple modes simultaneously [1], but only JVM benchmarks support it. For all other targets SuiteSourceGenerator fails as it expect at most one mode value [2]:

Execution failed for task ':benchmark:macosArm64BenchmarkGenerate'.
> There was a failure while executing work items
   > A failure occurred while executing kotlinx.benchmark.gradle.NativeSourceGeneratorWorker
      > List has more than one element.

...
Caused by: java.lang.IllegalArgumentException: List has more than one element.
        at kotlin.collections.CollectionsKt___CollectionsKt.single(_Collections.kt:610)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.generateBenchmark(SuiteSourceGenerator.kt:142)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:107)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:112)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:112)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:112)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:112)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.processPackage(SuiteSourceGenerator.kt:112)
        at kotlinx.benchmark.gradle.SuiteSourceGenerator.generate(SuiteSourceGenerator.kt:80)
        at kotlinx.benchmark.gradle.NativeSourceGeneratorWorker.execute(NativeSourceGeneratorTask.kt:78)
...

Multiple modes should be either supported across all targets, or the BenchmarkMode annotation should only accept a single argument in non-JVM source sets.

[1]

expect annotation class BenchmarkMode(vararg val value: Mode)

[2] https://github.com/Kotlin/kotlinx-benchmark/blob/3f32f2d9d9732a2a01d231134c52e6554428b519/plugin/main/src/kotlinx/benchmark/gradle/SuiteSourceGenerator.kt#L142C19-L142C19

@fzhinkin fzhinkin added the bug Something isn't working label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant