@@ -247,41 +247,46 @@ def __init__(self, config_name, options=None, env=None, virtualenv=None, iterati
247
247
@functools .lru_cache
248
248
def launcher_type (self ):
249
249
if mx .dependency ("GRAALPY_NATIVE_STANDALONE" , fatalIfMissing = False ):
250
- mx .log ("GraalPy native standalone is enabled, using it" )
251
250
return "native"
252
251
else :
253
- mx .log ("GraalPy native standalone is not enabled, using JVM standalone" )
254
252
return "jvm"
255
253
256
254
@property
255
+ @functools .lru_cache
257
256
def interpreter (self ):
258
257
from mx_graalpython import graalpy_standalone
259
- return graalpy_standalone (self .launcher_type , build = False )
258
+ launcher = graalpy_standalone (self .launcher_type , build = False )
259
+ mx .log (f"Using { launcher } based on enabled/excluded GraalPy standalone build targets." )
260
+ return launcher
260
261
261
- def run_vm (self , args , * splat , ** kwargs ):
262
+ def post_process_command_line_args (self , args ):
262
263
if os .environ .get ('BYTECODE_DSL_INTERPRETER' , '' ).lower () == 'true' and not self .is_bytecode_dsl_config ():
263
264
print ("Found environment variable BYTECODE_DSL_INTERPRETER, but the guest vm config is not Bytecode DSL config." )
264
265
print ("Did you want to use, e.g., `mx benchmark ... -- --host-vm-config=default-bc-dsl`?" )
265
266
sys .exit (1 )
266
- extra_polyglot_args = self .get_extra_polyglot_args ()
267
- return super ().run_vm (extra_polyglot_args + args , * splat , ** kwargs )
267
+ return self .get_extra_polyglot_args () + args
268
268
269
269
def is_bytecode_dsl_config (self ):
270
270
return '--vm.Dpython.EnableBytecodeDSLInterpreter=true' in self .get_extra_polyglot_args ()
271
271
272
- def run (self , * args , ** kwargs ):
273
- code , out , dims = super ().run (* args , ** kwargs )
274
-
272
+ def extract_vm_info (self , args ):
273
+ out_version = subprocess .check_output ([self .interpreter , '--version' ], universal_newlines = True )
275
274
# The benchmark data goes back a ways, we modify the reported dims for
276
275
# continuity with the historical queries
277
- _ , out_version , _ = super ().run (os .getcwd (), ["--version" ])
278
- dims ['guest-vm' ] = self .name ()
279
- dims ['guest-vm-config' ] = self .config_name ()
280
- dims ['host-vm' ] = 'graalvm-' + ('ee' if 'Oracle GraalVM' in out_version else 'ce' )
281
- dims ['host-vm-config' ] = self .launcher_type
276
+ dims = {
277
+ 'guest-vm' : self .name (),
278
+ 'guest-vm-config' : self .config_name (),
279
+ 'host-vm' : 'graalvm-' + ('ee' if 'Oracle GraalVM' in out_version else 'ce' ),
280
+ 'host-vm-config' : self .launcher_type ,
281
+ }
282
282
if dims ['guest-vm-config' ].endswith ('-3-compiler-threads' ):
283
283
dims ['guest-vm-config' ] = dims ['guest-vm-config' ].replace ('-3-compiler-threads' , '' )
284
284
dims ['host-vm-config' ] += '-3-compiler-threads'
285
+ self ._dims = dims
286
+
287
+ def run (self , * args , ** kwargs ):
288
+ code , out , dims = super ().run (* args , ** kwargs )
289
+ dims .update (self ._dims )
285
290
286
291
is_bytecode_dsl_config = self .is_bytecode_dsl_config ()
287
292
if "using bytecode DSL interpreter:" not in out :
@@ -292,7 +297,7 @@ def run(self, *args, **kwargs):
292
297
f"Expected Bytecode DSL interpreter = { is_bytecode_dsl_config } . Harness output:\n { out } " , file = sys .stderr )
293
298
return 1 , out , dims
294
299
return code , out , dims
295
-
300
+
296
301
def get_extra_polyglot_args (self ):
297
302
return ["--experimental-options" , "-snapshot-startup" , "--python.MaxNativeMemory=%s" % (2 ** 34 ), * self ._extra_polyglot_args ]
298
303
@@ -318,12 +323,6 @@ def config_name(self):
318
323
def hosting_registry (self ):
319
324
return java_vm_registry
320
325
321
- def launcher_class (self ):
322
- raise NotImplementedError ()
323
-
324
- def get_extra_polyglot_args (self ):
325
- raise NotImplementedError ()
326
-
327
326
def get_classpath (self ):
328
327
cp = []
329
328
if self ._cp_prefix :
@@ -361,7 +360,7 @@ def run(self, cwd, args):
361
360
return code , out , dims
362
361
363
362
def get_extra_polyglot_args (self ):
364
- return ["--experimental-options" , "--python.MaxNativeMemory=%s" % (2 ** 34 )] + self ._extra_polyglot_args
363
+ return ["--experimental-options" , "--python.MaxNativeMemory=%s" % (2 ** 34 ), * self ._extra_polyglot_args ]
365
364
366
365
367
366
# ----------------------------------------------------------------------------------------------------------------------
@@ -575,10 +574,11 @@ def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
575
574
ret_code , out , dims = super (PythonBaseBenchmarkSuite , self ).runAndReturnStdOut (benchmarks , bmSuiteArgs )
576
575
577
576
# host-vm rewrite rules
578
- if mx .suite ('graal-enterprise' , fatalIfMissing = False ):
579
- dims ['host-vm' ] = 'graalvm-ee'
580
- else :
581
- dims ['host-vm' ] = 'graalvm-ce'
577
+ if dims ['host-vm' ] not in ('graalvm-ce' , 'graalvm-ee' ):
578
+ if mx .suite ('graal-enterprise' , fatalIfMissing = False ):
579
+ dims ['host-vm' ] = 'graalvm-ee'
580
+ else :
581
+ dims ['host-vm' ] = 'graalvm-ce'
582
582
583
583
self .post_run_graph (benchmarks [0 ], dims ['host-vm-config' ], dims ['guest-vm-config' ])
584
584
0 commit comments