示例#1
0
def remote_env() -> LlvmEnv:
    """A test fixture that yields a connection to a remote service."""
    service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY)
    try:
        with LlvmEnv(service=service.connection.url) as env:
            yield env
    finally:
        service.close()
示例#2
0
def env(request) -> CompilerEnv:
    """Create an MLIR environment."""
    if request.param == "local":
        with gym.make("mlir-v0") as env:
            yield env
    else:
        service = CompilerGymServiceConnection(mlir.MLIR_SERVICE_BINARY)
        try:
            with MlirEnv(service=service.connection.url) as env:
                yield env
        finally:
            service.close()
示例#3
0
def env(request) -> CompilerEnv:
    """Create an LLVM environment."""
    if request.param == "local":
        with gym.make("llvm-v0") as env:
            yield env
    else:
        service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY)
        try:
            with LlvmEnv(service=service.connection.url) as env:
                yield env
        finally:
            service.close()
示例#4
0
def env(request) -> ClientServiceCompilerEnv:
    # Redefine fixture to test both gym.make(...) and unmanaged service
    # connections.
    if request.param == "local":
        with gym.make("llvm-v0") as env:
            yield env
    else:
        service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY)
        try:
            with LlvmEnv(service=service.connection.url) as env:
                yield env
        finally:
            service.close()
示例#5
0
def env(request) -> CompilerEnv:
    """Create an LLVM environment."""
    if request.param == "local":
        env = gym.make("llvm-v0")
        env.require_dataset("cBench-v0")
        try:
            yield env
        finally:
            env.close()
    else:
        service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY)
        env = LlvmEnv(service=service.connection.url, benchmark="foo")
        env.require_dataset("cBench-v0")
        try:
            yield env
        finally:
            env.close()
            service.close()
示例#6
0
def env(request) -> CompilerEnv:
    # Redefine fixture to test both gym.make(...) and unmanaged service
    # connections.
    if request.param == "local":
        env = gym.make("llvm-v0")
        env.require_dataset("cBench-v0")
        try:
            yield env
        finally:
            env.close()
    else:
        service = CompilerGymServiceConnection(llvm.LLVM_SERVICE_BINARY)
        env = LlvmEnv(service=service.connection.url, benchmark="foo")
        env.require_dataset("cBench-v0")
        try:
            yield env
        finally:
            env.close()
            service.close()