Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--blocks_per_json_file flag not working as expected #61

Closed
boomanaiden154 opened this issue Mar 5, 2024 · 1 comment · Fixed by #63
Closed

--blocks_per_json_file flag not working as expected #61

boomanaiden154 opened this issue Mar 5, 2024 · 1 comment · Fixed by #63
Assignees

Comments

@boomanaiden154
Copy link
Collaborator

Using the following CSV, test.csv:

85c044897c2460,98.000000
3b31,45.000000

With the following command line invocation, assuming ./json exists:

./bazel-bin/gematria/datasets/convert_bhive_to_llvm_exegesis_input --json_output_dir=./json --bhive_csv=./test.csv --blocks_per_json_file=1

We get the following in ./json:

0.json  1.json  2.json

Note that we should only get two files.

0.json:

[
  {
    "Hex": "85c044897c2460",
    "MemoryDefinitions": [
      {
        "Name": "MEM",
        "Size": 4096,
        "Value": 305419776
      }
    ],
    "MemoryMappings": [
      {
        "Address": 65536,
        "Value": "MEM"
      }
    ]
  }
]

1.json:

[
  {
    "Hex": "3b31",
    "MemoryDefinitions": [
      {
        "Name": "MEM",
        "Size": 4096,
        "Value": 305419776
      }
    ],
    "MemoryMappings": [
      {
        "Address": 65536,
        "Value": "MEM"
      }
    ]
  }
]

2.json:

[]

We see one of the blocks duplicated, the second block shows up twice, we get an extra file, and the extra file is empty. This needs to be fixed.

@boomanaiden154 boomanaiden154 self-assigned this Mar 5, 2024
boomanaiden154 added a commit to boomanaiden154/gematria that referenced this issue Mar 7, 2024
Currently, the logic in convert_bhive_to_llvm_exegesis_input will create
extra (empty) files as the output at the end runs unconditionally rather
than when there are actually blocks to output. This means that if we
have a number of blocks that is an exact multiple of the value in
blocks_per_json_file, we end up getting no blocks after the loop, which
means we output an empty JSON file.

Fixes google#61.
@boomanaiden154
Copy link
Collaborator Author

BB is not actually duplicated. I apparently just can't look at hex values.

boomanaiden154 added a commit that referenced this issue Mar 11, 2024
Currently, the logic in convert_bhive_to_llvm_exegesis_input will create
extra (empty) files as the output at the end runs unconditionally rather
than when there are actually blocks to output. This means that if we
have a number of blocks that is an exact multiple of the value in
blocks_per_json_file, we end up getting no blocks after the loop, which
means we output an empty JSON file.

Fixes #61.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant