Skip to content

examples/loop_optimizations_service/env_tests.py::test_default_autophase_dict_observation fails #631

Closed
@sogartar

Description

🐛 Bug

On my machine the test examples/loop_optimizations_service/env_tests.py::test_default_autophase_dict_observation is failing with

=================================== FAILURES ===================================
___________________ test_default_autophase_dict_observation ____________________

env = <compiler_gym.envs.compiler_env.CompilerEnv object at 0x7f7d2c61fa00>

    def test_default_autophase_dict_observation(env: CompilerEnv):
        """Test default autophase dict observation space."""
        env.observation_space = "AutophaseDict"
        observation = env.reset()
        assert isinstance(observation, dict)
>       assert observation.keys() == AUTOPHASE_FEATURE_NAMES
E       AssertionError: assert dict_keys(['NumGetElementPtrInst', 'numConstOnes', 'NumLShrInst', 'NumICmpInst', 'binaryConstArg', 'NumStoreInst', 'NumCallInst', 'const64Bit', 'oneSuccessor', 'BranchCount', 'TotalMemInst', 'NumXorInst', 'NumZExtInst', 'NumAllocaInst', 'BBNumArgsLo', 'BlockLow', 'NumAShrInst', 'morePreds', 'NumAddInst', 'onePredTwoSuc', 'ArgsPhi', 'NumSubInst', 'const32Bit', 'NumOrInst', 'CriticalCount', 'NumShlInst', 'onePred', 'BeginPhi', 'NumEdges', 'BlockMid', 'NumRetInst', 'NumTruncInst', 'testUnary', 'twoPred', 'twoSuccessor', 'TotalFuncs', 'NumPHIInst', 'NumSExtInst', 'BBHiPhi', 'BBNumArgsHi', 'BB03Phi', 'NumLoadInst', 'numConstZeroes', 'UncondBranches', 'NumMulInst', 'returnInt', 'NumAndInst', 'NumBrInst', 'BBNoPhi', 'onePredOneSuc', 'TotalBlocks', 'NumBitCastInst', 'NumSelectInst', 'TotalInsts', 'twoPredOneSuc', 'twoEach']) == ['BBNumArgsHi',\n 'BBNumArgsLo',\n 'onePred',\n 'onePredOneSuc',\n 'onePredTwoSuc',\n 'oneSuccessor',\n 'twoPred',\n 'twoPredOneSuc',\n 'twoEach',\n 'twoSuccessor',\n 'morePreds',\n 'BB03Phi',\n 'BBHiPhi',\n 'BBNoPhi',\n 'BeginPhi',\n 'BranchCount',\n 'returnInt',\n 'CriticalCount',\n 'NumEdges',\n 'const32Bit',\n 'const64Bit',\n 'numConstZeroes',\n 'numConstOnes',\n 'UncondBranches',\n 'binaryConstArg',\n 'NumAShrInst',\n 'NumAddInst',\n 'NumAllocaInst',\n 'NumAndInst',\n 'BlockMid',\n 'BlockLow',\n 'NumBitCastInst',\n 'NumBrInst',\n 'NumCallInst',\n 'NumGetElementPtrInst',\n 'NumICmpInst',\n 'NumLShrInst',\n 'NumLoadInst',\n 'NumMulInst',\n 'NumOrInst',\n 'NumPHIInst',\n 'NumRetInst',\n 'NumSExtInst',\n 'NumSelectInst',\n 'NumShlInst',\n 'NumStoreInst',\n 'NumSubInst',\n 'NumTruncInst',\n 'NumXorInst',\n 'NumZExtInst',\n 'TotalBlocks',\n 'TotalInsts',\n 'TotalMemInst',\n 'TotalFuncs',\n 'ArgsPhi',\n 'testUnary']
E         +dict_keys(['NumGetElementPtrInst', 'numConstOnes', 'NumLShrInst', 'NumICmpInst', 'binaryConstArg', 'NumStoreInst', 'NumCallInst', 'const64Bit', 'oneSuccessor', 'BranchCount', 'TotalMemInst', 'NumXorInst', 'NumZExtInst', 'NumAllocaInst', 'BBNumArgsLo', 'BlockLow', 'NumAShrInst', 'morePreds', 'NumAddInst', 'onePredTwoSuc', 'ArgsPhi', 'NumSubInst', 'const32Bit', 'NumOrInst', 'CriticalCount', 'NumShlInst', 'onePred', 'BeginPhi', 'NumEdges', 'BlockMid', 'NumRetInst', 'NumTruncInst', 'testUnary', 'twoPred', 'twoSuccessor', 'TotalFuncs', 'NumPHIInst', 'NumSExtInst', 'BBHiPhi', 'BBNumArgsHi', 'BB03Phi', 'NumLoadInst', 'numConstZeroes', 'UncondBranches', 'NumMulInst', 'returnInt', 'NumAndInst', 'NumBrInst', 'BBNoPhi', 'onePredOneSuc', 'TotalBlocks', 'NumBitCastInst', 'NumSelectInst', 'TotalInsts', 'twoPredOneSuc', 'twoEach'])
E         -['BBNumArgsHi', 'BBNumArgsLo', 'onePred', 'onePredOneSuc', 'onePredTwoSuc', 'oneSuccessor', 'twoPred', 'twoPredOneSuc', 'twoEach', 'twoSuccessor', 'morePreds', 'BB03Phi', 'BBHiPhi', 'BBNoPhi', 'BeginPhi', 'BranchCount', 'returnInt', 'CriticalCount', 'NumEdges', 'const32Bit', 'const64Bit', 'numConstZeroes', 'numConstOnes', 'UncondBranches', 'binaryConstArg', 'NumAShrInst', 'NumAddInst', 'NumAllocaInst', 'NumAndInst', 'BlockMid', 'BlockLow', 'NumBitCastInst', 'NumBrInst', 'NumCallInst', 'NumGetElementPtrInst', 'NumICmpInst', 'NumLShrInst', 'NumLoadInst', 'NumMulInst', 'NumOrInst', 'NumPHIInst', 'NumRetInst', 'NumSExtInst', 'NumSelectInst', 'NumShlInst', 'NumStoreInst', 'NumSubInst', 'NumTruncInst', 'NumXorInst', 'NumZExtInst', 'TotalBlocks', 'TotalInsts', 'TotalMemInst', 'TotalFuncs', 'ArgsPhi', 'testUnary']
E         Full diff:
E         + dict_keys(['NumGetElementPtrInst', 'numConstOnes', 'NumLShrInst', 'NumICmpInst', 'binaryConstArg', 'NumStoreInst', 'NumCallInst', 'const64Bit', 'oneSuccessor', 'BranchCount', 'TotalMemInst', 'NumXorInst', 'NumZExtInst', 'NumAllocaInst', 'BBNumArgsLo', 'BlockLow', 'NumAShrInst', 'morePreds', 'NumAddInst', 'onePredTwoSuc', 'ArgsPhi', 'NumSubInst', 'const32Bit', 'NumOrInst', 'CriticalCount', 'NumShlInst', 'onePred', 'BeginPhi', 'NumEdges', 'BlockMid', 'NumRetInst', 'NumTruncInst', 'testUnary', 'twoPred', 'twoSuccessor', 'TotalFuncs', 'NumPHIInst', 'NumSExtInst', 'BBHiPhi', 'BBNumArgsHi', 'BB03Phi', 'NumLoadInst', 'numConstZeroes', 'UncondBranches', 'NumMulInst', 'returnInt', 'NumAndInst', 'NumBrInst', 'BBNoPhi', 'onePredOneSuc', 'TotalBlocks', 'NumBitCastInst', 'NumSelectInst', 'TotalInsts', 'twoPredOneSuc', 'twoEach'],
E         + )
E         - [
E         -  'BBNumArgsHi',
E         -  'BBNumArgsLo',
E         -  'onePred',
E         -  'onePredOneSuc',
E         -  'onePredTwoSuc',
E         -  'oneSuccessor',
E         -  'twoPred',
E         -  'twoPredOneSuc',
E         -  'twoEach',
E         -  'twoSuccessor',
E         -  'morePreds',
E         -  'BB03Phi',
E         -  'BBHiPhi',
E         -  'BBNoPhi',
E         -  'BeginPhi',
E         -  'BranchCount',
E         -  'returnInt',
E         -  'CriticalCount',
E         -  'NumEdges',
E         -  'const32Bit',
E         -  'const64Bit',
E         -  'numConstZeroes',
E         -  'numConstOnes',
E         -  'UncondBranches',
E         -  'binaryConstArg',
E         -  'NumAShrInst',
E         -  'NumAddInst',
E         -  'NumAllocaInst',
E         -  'NumAndInst',
E         -  'BlockMid',
E         -  'BlockLow',
E         -  'NumBitCastInst',
E         -  'NumBrInst',
E         -  'NumCallInst',
E         -  'NumGetElementPtrInst',
E         -  'NumICmpInst',
E         -  'NumLShrInst',
E         -  'NumLoadInst',
E         -  'NumMulInst',
E         -  'NumOrInst',
E         -  'NumPHIInst',
E         -  'NumRetInst',
E         -  'NumSExtInst',
E         -  'NumSelectInst',
E         -  'NumShlInst',
E         -  'NumStoreInst',
E         -  'NumSubInst',
E         -  'NumTruncInst',
E         -  'NumXorInst',
E         -  'NumZExtInst',
E         -  'TotalBlocks',
E         -  'TotalInsts',
E         -  'TotalMemInst',
E         -  'TotalFuncs',
E         -  'ArgsPhi',
E         -  'testUnary',
E         - ]

examples/loop_optimizations_service/env_tests.py:227: AssertionError
---------------------------- Captured stderr setup -----------------------------
I0318 15:25:23.493640 140334948332352 create_and_run_compiler_gym_service.py:117] Service /dev/shm/compiler_gym_petkantchin/s/0318T152523-164730-47dd listening on 34091, PID = 2809987
I0318 15:25:23.542277 140334175786752 compiler_gym_service.py:105] GetSpaces()
----------------------------- Captured stderr call -----------------------------
I0318 15:25:23.550705 140334175786752 compiler_gym_service.py:114] StartSession(id=0, benchmark=benchmark://loops-opt-v0/add), 1 active sessions
I0318 15:25:23.553207 140334175786752 benchmark_cache.py:76] Cached benchmark benchmark://loops-opt-v0/add. Cache size = 22508 bytes, 1 items
I0318 15:25:23.554704 140334175786752 compiler_gym_service.py:114] StartSession(id=0, benchmark=benchmark://loops-opt-v0/add), 1 active sessions
I0318 15:25:23.554952 140334175786752 loops_opt_service.py:148] Started a compilation session for benchmark://loops-opt-v0/add
I0318 15:25:23.579383 140334175786752 loops_opt_service.py:261] Computing observation from space AutophaseDict
I0318 15:25:23.589350 140334175786752 compiler_gym_service.py:188] Step()
I0318 15:25:23.589824 140334175786752 loops_opt_service.py:261] Computing observation from space runtime
I0318 15:25:23.980890 140334175786752 compiler_gym_service.py:188] Step()
I0318 15:25:23.981082 140334175786752 loops_opt_service.py:261] Computing observation from space size
--------------------------- Captured stderr teardown ---------------------------
I0318 15:25:24.056299 140334175786752 compiler_gym_service.py:176] EndSession(id=0), 0 sessions remaining
I0318 15:25:24.056845 140334948332352 create_and_run_compiler_gym_service.py:48] Service received signal: 15
I0318 15:25:24.057053 140334948332352 create_and_run_compiler_gym_service.py:130] Shutting down the RPC service
I0318 15:25:24.057943 140334948332352 create_and_run_compiler_gym_service.py:133] Service closed
=========================== short test summary info ============================
FAILED examples/loop_optimizations_service/env_tests.py::test_default_autophase_dict_observation
======================== 1 failed, 22 passed in 18.68s =========================

This happens on commit d22fd36.
I am not sure why it does not fail on the CI, does it even run there?

To Reproduce

Run in source directory

bazel run //examples/loop_optimizations_service:env_tests

Environment

  • CompilerGym:
  • How you installed CompilerGym (conda, pip, source): source
  • OS: Ubuntu 20.04
  • Python version: 3.8.12
  • Build command you used (if compiling from source): bazel run
  • GCC/clang version (if compiling from source): GCC 9.4.0 and clang 12.0.0
  • Bazel version (if compiling from source): 4.2.2
  • Versions of any other relevant libraries:

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions