Skip to content

Commit

Permalink
feat(all): implement SPIR-V parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rayanht committed May 12, 2022
1 parent 5ed4a5c commit 9ecced7
Show file tree
Hide file tree
Showing 47 changed files with 2,747 additions and 3,037 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@ out/
**/**.spv
**/**.amber
**/**.spasm

**/**.pkl
**/**.plist
**/**.metal
**/**.metallib
**/**.txt
14 changes: 10 additions & 4 deletions amber_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import argparse
import os
import platform
import signal
import subprocess
import sys
import tempfile
from functools import reduce
from itertools import repeat
Expand Down Expand Up @@ -31,9 +33,13 @@

MONITOR = Monitor()

STORAGE_CLIENT = storage.Client.from_service_account_json("infra/spirvsmith_gcp.json")
BQ_CLIENT = bigquery.Client.from_service_account_json("infra/spirvsmith_gcp.json")
BUCKET = STORAGE_CLIENT.get_bucket("spirv_shaders_bucket")

if "pytest" not in sys.modules:
STORAGE_CLIENT = storage.Client.from_service_account_json(
"infra/spirvsmith_gcp.json"
)
BQ_CLIENT = bigquery.Client.from_service_account_json("infra/spirvsmith_gcp.json")
BUCKET = STORAGE_CLIENT.get_bucket("spirv_shaders_bucket")


def get_pending_shaders_query(
Expand Down Expand Up @@ -122,7 +128,7 @@ def run_amber(amber_filename: str, n_buffers: int, shader_id: str) -> str:
print(process.stderr.decode("utf-8"))
return None

if process.returncode == 139:
if process.returncode == -signal.SIGSEGV:
MONITOR.error(
event=Event.AMBER_SEGFAULT,
extra={
Expand Down
57 changes: 56 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ black = {version = "^22.3", allow-prereleases = true}
autoflake = "^1.4"
pytest-flakefinder = "^1.0.0"
pre-commit = "^2.18.1"
mypy = "^0.950"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
7 changes: 3 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ class FuzzingStrategyConfig:
w_memory_operation: int = 4
w_logical_operation: int = 4
w_arithmetic_operation: int = 4
w_control_flow_operation: int = 1
w_control_flow_operation: int = 0
w_function_operation: int = 1
w_bitwise_operation: int = 4
w_conversion_operation: int = 4
w_composite_operation: int = 4

## Types weights
w_scalar_type: int = 1
w_numerical_type: int = 1
w_container_type: int = 1
w_arithmetic_type: int = 1

## Constants weights
w_composite_constant: int = 1
Expand All @@ -59,7 +57,8 @@ class FuzzingStrategyConfig:
@dataclass
class MiscConfig:
start_web_server: bool = False
broadcast_generated_shaders: bool = True
broadcast_generated_shaders: bool = False
upload_logs: bool = False
version: str = get_spirvsmith_version()


Expand Down
Loading

0 comments on commit 9ecced7

Please sign in to comment.