Exemplo n.º 1
0
def mx_register_dynamic_suite_constituents(register_project,
                                           register_distribution):
    """
    :type register_project: (mx.Project) -> None
    :type register_distribution: (mx.Distribution) -> None
    """
    if mx_sdk_vm_impl.has_component('FastR'):
        fastr_release_env = mx.get_env('FASTR_RELEASE', None)
        if fastr_release_env != 'true':
            mx.abort((
                'When including FastR, please set FASTR_RELEASE to \'true\' (env FASTR_RELEASE=true mx ...). Got FASTR_RELEASE={}. '
                'For local development, you may also want to disable recommended packages build (FASTR_NO_RECOMMENDED=true) and '
                'capturing of system libraries (export FASTR_CAPTURE_DEPENDENCIES set to an empty value). '
                'See building.md in FastR documentation for more details.'
            ).format(fastr_release_env))
    if register_project:
        register_project(GraalVmSymlinks())

        benchmark_dist = _suite.dependency("POLYBENCH_BENCHMARKS")

        def _add_project_to_dist(destination,
                                 name,
                                 source='dependency:{name}/*'):
            if destination not in benchmark_dist.layout:
                benchmark_dist.layout[destination] = []
            benchmark_dist.layout[destination].append(source.format(name=name))
            benchmark_dist.buildDependencies.append(name)

        if mx_sdk_vm_impl.has_component('GraalWasm'):
            import mx_wasm

            class GraalVmWatProject(mx_wasm.WatProject):
                def getSourceDir(self):
                    return self.subDir

                def isBenchmarkProject(self):
                    return self.name.startswith("benchmarks.")

            register_project(
                GraalVmWatProject(
                    suite=_suite,
                    name='benchmarks.interpreter.wasm',
                    deps=[],
                    workingSets=None,
                    subDir=join(_suite.dir, 'benchmarks', 'interpreter'),
                    theLicense=None,
                    testProject=True,
                    defaultBuild=False,
                ))
            # add wasm to the layout of the benchmark distribution
            _add_project_to_dist('./interpreter/',
                                 'benchmarks.interpreter.wasm')

        if mx_sdk_vm_impl.has_component('LLVM Runtime Native'):
            register_project(
                mx.NativeProject(
                    suite=_suite,
                    name='benchmarks.interpreter.llvm.native',
                    results=['interpreter/'],
                    buildEnv={
                        'NATIVE_LLVM_CC': '<toolchainGetToolPath:native,CC>',
                    },
                    buildDependencies=[
                        'sulong:SULONG_BOOTSTRAP_TOOLCHAIN',
                    ],
                    vpath=True,
                    deps=[],
                    workingSets=None,
                    d=join(_suite.dir, 'benchmarks', 'interpreter'),
                    subDir=None,
                    srcDirs=[''],
                    output=None,
                    theLicense=None,
                    testProject=True,
                    defaultBuild=False,
                ))
            # add bitcode to the layout of the benchmark distribution
            _add_project_to_dist('./', 'benchmarks.interpreter.llvm.native')
Exemplo n.º 2
0
def mx_register_dynamic_suite_constituents(register_project, register_distribution):
    """
    :type register_project: (mx.Project) -> None
    :type register_distribution: (mx.Distribution) -> None
    """
    if mx_sdk_vm_impl.has_component('FastR'):
        fastr_release_env = mx.get_env('FASTR_RELEASE', None)
        if fastr_release_env != 'true':
            mx.abort(('When including FastR, please set FASTR_RELEASE to \'true\' (env FASTR_RELEASE=true mx ...). Got FASTR_RELEASE={}. '
                      'For local development, you may also want to disable recommended packages build (FASTR_NO_RECOMMENDED=true) and '
                      'capturing of system libraries (export FASTR_CAPTURE_DEPENDENCIES set to an empty value). '
                      'See building.md in FastR documentation for more details.').format(fastr_release_env))
    if register_project:
        register_project(GraalVmSymlinks())

        benchmark_dist = _suite.dependency("POLYBENCH_BENCHMARKS")

        def _add_project_to_dist(destination, name, source='dependency:{name}/*'):
            if destination not in benchmark_dist.layout:
                benchmark_dist.layout[destination] = []
            benchmark_dist.layout[destination].append(source.format(name=name))
            benchmark_dist.buildDependencies.append(name)

        if mx_sdk_vm_impl.has_component('GraalWasm'):
            import mx_wasm

            class GraalVmWatProject(mx_wasm.WatProject):
                def getSourceDir(self):
                    return self.subDir

                def isBenchmarkProject(self):
                    return self.name.startswith("benchmarks.")

            register_project(GraalVmWatProject(
                suite=_suite,
                name='benchmarks.interpreter.wasm',
                deps=[],
                workingSets=None,
                subDir=join(_suite.dir, 'benchmarks', 'interpreter'),
                theLicense=None,
                testProject=True,
                defaultBuild=False,
            ))
            # add wasm to the layout of the benchmark distribution
            _add_project_to_dist('./interpreter/', 'benchmarks.interpreter.wasm')

        if mx_sdk_vm_impl.has_component('LLVM Runtime Native'):
            register_project(mx.NativeProject(
                suite=_suite,
                name='benchmarks.interpreter.llvm.native',
                results=['interpreter/'],
                buildEnv={
                    'NATIVE_LLVM_CC': '<toolchainGetToolPath:native,CC>',
                },
                buildDependencies=[
                    'sulong:SULONG_BOOTSTRAP_TOOLCHAIN',
                ],
                vpath=True,
                deps=[],
                workingSets=None,
                d=join(_suite.dir, 'benchmarks', 'interpreter'),
                subDir=None,
                srcDirs=[''],
                output=None,
                theLicense=None,
                testProject=True,
                defaultBuild=False,
            ))
            # add bitcode to the layout of the benchmark distribution
            _add_project_to_dist('./', 'benchmarks.interpreter.llvm.native')

        if mx_sdk_vm_impl.has_component('Java on Truffle'):
            java_benchmarks = join(_suite.dir, 'benchmarks', 'interpreter', 'java')
            for f in os.listdir(java_benchmarks):
                if isdir(join(java_benchmarks, f)) and not f.startswith("."):
                    main_class = basename(f)
                    simple_name = main_class.split(".")[-1]

                    project_name = 'benchmarks.interpreter.espresso.' + simple_name.lower()
                    register_project(mx.JavaProject(
                        suite=_suite,
                        subDir=None,
                        srcDirs=[join(_suite.dir, 'benchmarks', 'interpreter', 'java', main_class)],
                        deps=[],
                        name=project_name,
                        d=join(_suite.dir, 'benchmarks', 'interpreter', 'java', main_class),
                        javaCompliance='11+',
                        checkstyleProj=project_name,
                        workingSets=None,
                        theLicense=None,
                        testProject=True,
                        defaultBuild=False,
                    ))

                    dist_name = 'POLYBENCH_ESPRESSO_' + simple_name.upper()
                    register_distribution(mx_jardistribution.JARDistribution(
                        suite=_suite,
                        subDir=None,
                        srcDirs=[''],
                        sourcesPath=[],
                        deps=[project_name],
                        mainClass=main_class,
                        name=dist_name,
                        path=simple_name + '.jar',
                        platformDependent=False,
                        distDependencies=[],
                        javaCompliance='11+',
                        excludedLibs=[],
                        workingSets=None,
                        theLicense=None,
                        testProject=True,
                        defaultBuild=False,
                    ))
                    # add jars to the layout of the benchmark distribution
                    _add_project_to_dist('./interpreter/{}.jar'.format(simple_name), dist_name,
                        source='dependency:{name}/polybench-espresso-' + simple_name.lower() + '.jar')