Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions workloads/linux/spec2006/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ make spec2006-images SPEC2006_ISO=/path/to/cpu2006.iso SPEC2006_INPUT=test -jN
make spec2006-images SPEC2006_ISO=/path/to/cpu2006.iso SPEC2006_INPUT=all -jN
```

Export a single configured case with `BENCH`:

```sh
make spec2006-images BENCH=mcf SPEC2006_ISO=/path/to/cpu2006.iso -jN
make spec2006-images BENCH=astar_biglakes SPEC2006_ISO=/path/to/cpu2006.iso -jN
```

Selected SPEC cases are built one by one to avoid concurrent `runspec`
instances contending on shared temporary state inside the SPEC tool tree.

Expand All @@ -57,14 +64,21 @@ The export directory is organized as:
build/images/spec2006/
bin/<case>.fw_payload.bin
kernel/<case>.Image
rootfs/<case>.rootfs.cpio
elf/<case>.elf
cmd/<case>.run.sh
gcpt/gcpt.elf
gcpt/gcpt.bin
cfg/<spec-cfg-name>
logs/build_elf/<case>.log
stamps/<case>.images.stamp
```

`gcpt/` and `cfg/` are copied once per export tree, not once per case.

Re-running `make spec2006-images` rebuilds the export tree so the directory
layout and contents stay complete and consistent.

Override the destination with `SPEC2006_IMAGE_DIR=/path/to/image`.

## Build ELF only
Expand Down
26 changes: 18 additions & 8 deletions workloads/linux/spec2006/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ SPEC2006_DTC ?= $(SPEC2006_BUILDROOT_DIR)/output/host/bin/dtc
SPEC2006_CASE := $(if $(INPUT),$(BENCH)_$(INPUT),$(BENCH))
SPEC2006_ALL_CASES := $(shell python3 $(SPEC2006_HELPER) --cases-config $(SPEC2006_CASE_CONFIG) --list-cases 2>/dev/null)
SPEC2006_SELECTED_CASES := $(shell python3 $(SPEC2006_HELPER) --cases-config $(SPEC2006_CASE_CONFIG) --list-cases --input-set $(SPEC2006_INPUT) 2>/dev/null)
SPEC2006_IMAGE_CASES := $(SPEC2006_SELECTED_CASES)
SPEC2006_IMAGE_CASES := $(if $(BENCH),$(SPEC2006_CASE),$(SPEC2006_SELECTED_CASES))
SPEC2006_ELF_TARGETS := $(foreach case,$(SPEC2006_SELECTED_CASES),$(SPEC2006_BUILD_DIR)/$(case)/elf/$(case).elf)
SPEC2006_DTS_SOURCES := $(shell find $(SPEC2006_DTS_DIR) -type f 2>/dev/null)
SPEC2006_DEFAULT_DTB_STAMP := $(SPEC2006_BUILD_DIR)/dtb.$(shell printf '%s\n' "$(SPEC2006_DEFAULT_DTB)" | sha256sum | cut -d ' ' -f 1)
spec2006_case_image_stamp = $(SPEC2006_IMAGE_DIR)/stamps/$(1).images.stamp

WORKLOAD_DIRS += $(SPEC2006_BUILD_DIR)

Expand Down Expand Up @@ -132,9 +133,9 @@ linux/$(1): $(SPEC2006_BUILD_DIR)/$(1)/fw_payload.bin

WORKLOAD_PHONY_TARGETS += linux/$(1)

$(SPEC2006_IMAGE_DIR)/bin/$(1).fw_payload.bin: $(SPEC2006_BUILD_DIR)/$(1)/fw_payload.bin $(SPEC2006_LINUX_IMAGE)
$(call spec2006_case_image_stamp,$(1)): $(SPEC2006_PREPARE_STAMP) $(SPEC2006_BUILD_DIR)/$(1)/fw_payload.bin $(SPEC2006_GCPT_ELF) $(SPEC2006_GCPT_BIN) $(SPEC2006_LINUX_IMAGE) | spec2006-check-spec-iso
@printf '$(SPEC2006_PROGRESS_PREFIX) Exporting $(1) artifacts to $(SPEC2006_IMAGE_DIR)\n'
@mkdir -p "$(SPEC2006_IMAGE_DIR)/bin" "$(SPEC2006_IMAGE_DIR)/kernel" "$(SPEC2006_IMAGE_DIR)/elf" "$(SPEC2006_IMAGE_DIR)/cfg" "$(SPEC2006_IMAGE_DIR)/gcpt"
@mkdir -p "$(SPEC2006_IMAGE_DIR)/bin" "$(SPEC2006_IMAGE_DIR)/kernel" "$(SPEC2006_IMAGE_DIR)/rootfs" "$(SPEC2006_IMAGE_DIR)/elf" "$(SPEC2006_IMAGE_DIR)/cmd" "$(SPEC2006_IMAGE_DIR)/cfg" "$(SPEC2006_IMAGE_DIR)/gcpt" "$(SPEC2006_IMAGE_DIR)/logs/build_elf" "$(SPEC2006_IMAGE_DIR)/stamps"
@if [ ! -f "$(SPEC2006_IMAGE_DIR)/cfg/$(notdir $(SPEC2006_CFG))" ]; then \
printf '$(SPEC2006_PROGRESS_PREFIX) Exporting spec2006 cfg to $(SPEC2006_IMAGE_DIR)/cfg\n'; \
cp "$(SPEC2006_CFG)" "$(SPEC2006_IMAGE_DIR)/cfg/$(notdir $(SPEC2006_CFG))"; \
Expand All @@ -144,9 +145,13 @@ $(SPEC2006_IMAGE_DIR)/bin/$(1).fw_payload.bin: $(SPEC2006_BUILD_DIR)/$(1)/fw_pay
cp "$(SPEC2006_GCPT_ELF)" "$(SPEC2006_IMAGE_DIR)/gcpt/gcpt.elf"; \
cp "$(SPEC2006_GCPT_BIN)" "$(SPEC2006_IMAGE_DIR)/gcpt/gcpt.bin"; \
fi
@cp $(SPEC2006_BUILD_DIR)/$(1)/elf/$(1).elf $(SPEC2006_IMAGE_DIR)/elf/$(1).elf
@cp $(SPEC2006_LINUX_IMAGE) $(SPEC2006_IMAGE_DIR)/kernel/$(1).Image
@cp $(SPEC2006_BUILD_DIR)/$(1)/fw_payload.bin $(SPEC2006_IMAGE_DIR)/bin/$(1).fw_payload.bin
@cp "$(SPEC2006_BUILD_DIR)/$(1)/elf/$(1).elf" "$(SPEC2006_IMAGE_DIR)/elf/$(1).elf"
@cp "$(SPEC2006_BUILD_DIR)/$(1)/logs/build_elf/build.log" "$(SPEC2006_IMAGE_DIR)/logs/build_elf/$(1).log"
@cp "$(SPEC2006_LINUX_IMAGE)" "$(SPEC2006_IMAGE_DIR)/kernel/$(1).Image"
@cp "$(SPEC2006_BUILD_DIR)/$(1)/rootfs.cpio" "$(SPEC2006_IMAGE_DIR)/rootfs/$(1).rootfs.cpio"
@cp "$(SPEC2006_BUILD_DIR)/$(1)/fw_payload.bin" "$(SPEC2006_IMAGE_DIR)/bin/$(1).fw_payload.bin"
@cp "$(SPEC2006_BUILD_DIR)/$(1)/package/spec/run.sh" "$(SPEC2006_IMAGE_DIR)/cmd/$(1).run.sh"
@touch "$$@"
endef

$(foreach case,$(SPEC2006_ALL_CASES),$(eval $(call add_spec2006_case,$(case))))
Expand Down Expand Up @@ -177,15 +182,20 @@ spec2006-elfs: spec2006-check-spec-iso
done

spec2006-images: spec2006-check-spec-iso
@if [ -z "$(SPEC2006_IMAGE_CASES)" ]; then \
@if [ -n "$(BENCH)" ] && [ -z "$(filter $(SPEC2006_CASE),$(SPEC2006_ALL_CASES))" ]; then \
echo "Unknown SPEC2006 case for BENCH=$(BENCH) INPUT=$(INPUT)"; \
exit 1; \
fi; \
if [ -z "$(SPEC2006_IMAGE_CASES)" ]; then \
echo "No SPEC2006 cases selected by SPEC2006_INPUT=$(SPEC2006_INPUT)"; \
exit 1; \
fi; \
rm -rf "$(SPEC2006_IMAGE_DIR)/bin" "$(SPEC2006_IMAGE_DIR)/kernel" "$(SPEC2006_IMAGE_DIR)/rootfs" "$(SPEC2006_IMAGE_DIR)/elf" "$(SPEC2006_IMAGE_DIR)/cmd" "$(SPEC2006_IMAGE_DIR)/cfg" "$(SPEC2006_IMAGE_DIR)/gcpt" "$(SPEC2006_IMAGE_DIR)/logs" "$(SPEC2006_IMAGE_DIR)/stamps"; \
total="$(words $(SPEC2006_IMAGE_CASES))"; \
i=0; \
for case in $(SPEC2006_IMAGE_CASES); do \
i=$$((i + 1)); \
SPEC2006_PROGRESS_K="$$i" SPEC2006_PROGRESS_N="$$total" $(MAKE) --no-print-directory -f "$(SPEC2006_RECURSE_MAKEFILE)" GCPT_DEFAULT_DTB="$(SPEC2006_DEFAULT_DTB)" "$(SPEC2006_IMAGE_DIR)/bin/$$case.fw_payload.bin" || exit $$?; \
SPEC2006_PROGRESS_K="$$i" SPEC2006_PROGRESS_N="$$total" $(MAKE) --no-print-directory -f "$(SPEC2006_RECURSE_MAKEFILE)" GCPT_DEFAULT_DTB="$(SPEC2006_DEFAULT_DTB)" "$(call spec2006_case_image_stamp,$$case)" || exit $$?; \
done
@printf '[spec2006 %s/%s] Output written to %s\n' "$(words $(SPEC2006_IMAGE_CASES))" "$(words $(SPEC2006_IMAGE_CASES))" "$(abspath $(SPEC2006_IMAGE_DIR))"

Expand Down
12 changes: 12 additions & 0 deletions workloads/linux/spec2006/spec2006-package.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ def export_elf_artifact(elf, case_name, out_dir):
return exported_elf


def export_build_log_artifact(build_log, out_dir):
if not build_log.is_file():
return None
log_dir = out_dir / "logs" / "build_elf"
log_dir.mkdir(parents=True, exist_ok=True)
exported_log = log_dir / build_log.name
shutil.copy2(build_log, exported_log)
return exported_log


def install_runtime_binary(elf, binary_name, pkg_dir):
spec_root = pkg_dir / "spec"
shutil.copy2(elf, spec_root / binary_name)
Expand Down Expand Up @@ -499,6 +509,7 @@ def build_elf(spec_dir, bench_dir, spec_cfg, out_dir, log_dir, cross_compile, tu
elf = None
if elf is not None:
status(f"Reusing {bench_dir} build from {shared_dir}")
export_build_log_artifact(build_log, out_dir)
return elf, build_log

if output_root.exists():
Expand Down Expand Up @@ -547,6 +558,7 @@ def build_elf(spec_dir, bench_dir, spec_cfg, out_dir, log_dir, cross_compile, tu
detail = explain_missing_elf(output_root, bench_dir, tune)
raise RuntimeError(str(exc) + detail) from exc
write_json(metadata_path, metadata)
export_build_log_artifact(build_log, out_dir)
return elf, build_log


Expand Down
2 changes: 2 additions & 0 deletions workloads/linux/spec2017/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ perlbench_rate_refrate_00_checkspam.2500.5.25.11.150.1.1.1.1.fw_payload.bin
Useful selectors:

```sh
make spec2017-images BENCH=mcf MODE=rate INPUT=test SPEC2017_ISO=/path/to/cpu2017.iso -jN
make spec2017-images BENCH=mcf MODE=speed INPUT=test SPEC2017_ISO=/path/to/cpu2017.iso -jN
make spec2017-images SPEC2017_ISO=/path/to/cpu2017.iso SPEC2017_IMAGE_INPUT=test -jN
make spec2017-images SPEC2017_ISO=/path/to/cpu2017.iso SPEC2017_IMAGE_INPUT=all -jN
make spec2017-images SPEC2017_ISO=/path/to/cpu2017.iso SPEC2017_IMAGE_MODE=rate -jN
Expand Down
12 changes: 8 additions & 4 deletions workloads/linux/spec2017/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SPEC2017_BUILD_VARS_HASH := $(shell printf '%s\n' '$(SPEC2017_PROFILING)' '$(SPE
SPEC2017_CASE := $(shell $(SPEC2017_PYTHON) $(SPEC2017_HELPER) --resolve-case --bench '$(BENCH)' --input-set '$(SPEC2017_INPUT)' --mode '$(SPEC2017_MODE)' 2>/dev/null)
SPEC2017_ALL_CASES := $(shell $(SPEC2017_PYTHON) $(SPEC2017_HELPER) --list-cases --input-set all --mode all 2>/dev/null)
SPEC2017_SELECTED_CASES := $(shell $(SPEC2017_PYTHON) $(SPEC2017_HELPER) --list-cases --input-set $(SPEC2017_INPUT) --mode $(SPEC2017_MODE) 2>/dev/null)
SPEC2017_IMAGE_CASES := $(shell $(SPEC2017_PYTHON) $(SPEC2017_HELPER) --list-cases --input-set $(SPEC2017_IMAGE_INPUT) --mode $(SPEC2017_IMAGE_MODE) 2>/dev/null)
SPEC2017_IMAGE_CASES := $(if $(BENCH),$(SPEC2017_CASE),$(shell $(SPEC2017_PYTHON) $(SPEC2017_HELPER) --list-cases --input-set $(SPEC2017_IMAGE_INPUT) --mode $(SPEC2017_IMAGE_MODE) 2>/dev/null))
SPEC2017_DTS_SOURCES := $(shell find $(SPEC2017_DTS_DIR) -type f 2>/dev/null)

WORKLOAD_DIRS += $(SPEC2017_BUILD_DIR)
Expand Down Expand Up @@ -246,7 +246,7 @@ linux/spec2017: spec2017-check-spec-config
echo "Cannot resolve SPEC2017 case from BENCH=$(BENCH), MODE=$(SPEC2017_MODE), INPUT=$(SPEC2017_INPUT)"; \
exit 1; \
fi
@$(MAKE) --no-print-directory -f "$(SPEC2017_RECURSE_MAKEFILE)" $(SPEC2017_BUILD_DIR)/$(SPEC2017_CASE)/fw_payload.bin
@$(MAKE) --no-print-directory -f "$(SPEC2017_RECURSE_MAKEFILE)" GCPT_DEFAULT_DTB="$(SPEC2017_DEFAULT_DTB)" $(SPEC2017_BUILD_DIR)/$(SPEC2017_CASE)/fw_payload.bin

spec2017-elf: spec2017-check-spec-config
@if [ -z "$(BENCH)" ]; then \
Expand All @@ -272,7 +272,11 @@ spec2017-elfs: spec2017-check-spec-config
done

spec2017-images: spec2017-check-spec-config
@if [ -z "$(SPEC2017_IMAGE_CASES)" ]; then \
@if [ -n "$(BENCH)" ] && [ -z "$(SPEC2017_CASE)" ]; then \
echo "Cannot resolve SPEC2017 case from BENCH=$(BENCH), MODE=$(SPEC2017_MODE), INPUT=$(SPEC2017_INPUT)"; \
exit 1; \
fi; \
if [ -z "$(SPEC2017_IMAGE_CASES)" ]; then \
echo "No SPEC2017 cases selected by SPEC2017_IMAGE_INPUT=$(SPEC2017_IMAGE_INPUT) SPEC2017_IMAGE_MODE=$(SPEC2017_IMAGE_MODE)"; \
exit 1; \
fi; \
Expand All @@ -281,7 +285,7 @@ spec2017-images: spec2017-check-spec-config
i=0; \
for case in $(SPEC2017_IMAGE_CASES); do \
i=$$((i + 1)); \
SPEC2017_PROGRESS_K="$$i" SPEC2017_PROGRESS_N="$$total" $(MAKE) --no-print-directory -f "$(SPEC2017_RECURSE_MAKEFILE)" "$(SPEC2017_IMAGE_DIR)/stamps/$$case.images.stamp" || exit $$?; \
SPEC2017_PROGRESS_K="$$i" SPEC2017_PROGRESS_N="$$total" $(MAKE) --no-print-directory -f "$(SPEC2017_RECURSE_MAKEFILE)" GCPT_DEFAULT_DTB="$(SPEC2017_DEFAULT_DTB)" "$(SPEC2017_IMAGE_DIR)/stamps/$$case.images.stamp" || exit $$?; \
done
@printf '[spec2017 %s/%s] Output written to %s\n' "$(words $(SPEC2017_IMAGE_CASES))" "$(words $(SPEC2017_IMAGE_CASES))" "$(abspath $(SPEC2017_IMAGE_DIR))"

Expand Down
38 changes: 31 additions & 7 deletions workloads/linux/spec2026/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# SPEC CPU2026 Linux Workload

This workload prepares a writable SPEC workspace from `SPEC2026_ISO` first,
then builds cases against that local install.

Prepare the workspace:

```sh
make spec2026-prepare SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso
```

Build one case:

```sh
Expand All @@ -13,13 +22,14 @@ make spec2026-images SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso -jN
```

Default image export mode is `rate`. Use `MODE=speed` or `MODE=all` to
change the selected cases.
change the selected cases. `SPEC2026_IMAGE_MODE` and `SPEC2026_IMAGE_INPUT`
can be used independently from the single-case build selectors.

Output goes to `build/images/spec2026`.
Rate cases are written to `build/images/spec2026rate`; speed cases are written
to `build/images/spec2026speed`.
By default, rate images are exported under `build/images/spec2026rate/` and
speed images under `build/images/spec2026speed/`. `SPEC2026_IMAGE_MODE=all`
keeps the combined export under `build/images/spec2026/`.

The export tree now includes:
The export tree is:

```text
build/images/spec2026rate/
Expand Down Expand Up @@ -47,5 +57,19 @@ build/images/spec2026speed/
stamps/<case>.images.stamp
```

Re-running `make spec2026-images` skips completed cases and resumes an
interrupted case build through `build/linux-workloads/spec2026/_bench-builds`.
Useful selectors:

```sh
make spec2026-images BENCH=706.stockfish_r SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso -jN
make spec2026-images BENCH=800.pot3d_s MODE=speed SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso -jN
make spec2026-images SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso SPEC2026_IMAGE_INPUT=test -jN
make spec2026-images SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso SPEC2026_IMAGE_INPUT=all -jN
make spec2026-images SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso SPEC2026_IMAGE_MODE=rate -jN
make spec2026-images SPEC2026_ISO=/path/to/cpu2026-1.0.1.iso SPEC2026_IMAGE_MODE=all -jN
```

`SPEC2026_IMAGE_MODE=all` exports both rate and speed images into the same
combined tree that `SPEC2026_IMAGE_DIR` points to.

Re-running `make spec2026-images` rebuilds the export tree so the directory
layout and contents stay complete and consistent.
Loading
Loading