Closed Quafadas closed 2 weeks ago
Yup, this works, PR incoming.
object benchmark extends JmhModule with ScalaModule {
def scalaVersion = vecxt.jvm.scalaVersion
def jmhCoreVersion = "1.37"
override def javacOptions: T[Seq[String]] = super.javacOptions() ++ vecIncubatorFlag
override def moduleDeps: Seq[JavaModule] = Seq(vecxt.jvm)
override def generateBenchmarkSources = T{
val dest = T.ctx().dest
val javacOpts = javacOptions().toSeq
val sourcesDir = dest / "jmh_sources"
val resourcesDir = dest / "jmh_resources"
os.remove.all(sourcesDir)
os.makeDir.all(sourcesDir)
os.remove.all(resourcesDir)
os.makeDir.all(resourcesDir)
Jvm.runSubprocess(
"org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator",
(runClasspath() ++ generatorDeps()).map(_.path),
mainArgs = Seq(
compile().classes.path.toString,
sourcesDir.toString,
resourcesDir.toString,
"default"
),
jvmArgs = javacOpts
)
(sourcesDir, resourcesDir)
}
}
I'm trying to benchmark the start of my attempts to play with project Panama's
VectorAPI
.I've successfully run JMH like this;
mill benchmark.runJmh -jvmArgs --add-modules=jdk.incubator.vector -rf json vecxt.benchmark.DgemmBenchmark
Which works If I'm depending on a library which uses the VectorAPI. However, it seems that if I try to use it directly myself, Jmh becomes unhappy.
I suspect, but am a little lost on how to prove, that this is because Jmh does some source generation, but the plugin doesn't pass
javaCOptions
to the process which does the codegen?https://github.com/com-lihaoyi/mill/blob/b5e04d6b8b93d185f61e34697aee33c0d92e595a/contrib/jmh/src/mill/contrib/jmh/JmhModule.scala#L84
Does that sound plausible?