diff --git a/.gitignore b/.gitignore index e2c52ea3..7e7f3b27 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ testsuite.py test.conf testsuite* testlogs/ +llvm/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e0cb396..404fbf1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) set(CMAKE_VERBOSE_MAKEFILE TRUE) set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs") -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE +set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "-Wl,--whole-archive -Wl,--no-whole-archive" ) set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED True) @@ -57,6 +57,11 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake) +# Spatz support +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/spatz_config.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/spatz_helpers.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/bootrom_helpers.cmake) + ################################################################################ # Add subdirectories # ################################################################################ @@ -74,4 +79,4 @@ add_subdirectory(drivers) # Testing # ################################################################################ -add_subdirectory(tests) \ No newline at end of file +add_subdirectory(tests) diff --git a/Makefile b/Makefile index 4aacc409..19c9e029 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 2025 ETH Zurich and University of Bologna # -# Licensed under the Solderpad Hardware License, Version 0.51 -# (the "License"); you may not use this file except in compliance +# Licensed under the Solderpad Hardware License, Version 0.51 +# (the "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 @@ -15,13 +15,15 @@ # # Authors: Victor Isachi # Alberto Dequino -# +# # Magia-sdk Makefile SHELL := /bin/bash BUILD_DIR ?= ../sw/tests/$(test) MAGIA_DIR ?= ../ +MAGIA_DIR_ABS ?= $(abspath $(MAGIA_DIR)) +BUILD_DIR_ABS ?= $(MAGIA_DIR_ABS)/sw/tests/$(test) GVSOC_DIR ?= ./gvsoc CURR_DIR ?= $(shell pwd) GVSOC_ABS_PATH ?= $(CURR_DIR)/gvsoc @@ -46,6 +48,15 @@ compiler ?= GCC_PULP ISA ?= rv32imcxgap9 gui ?= 0 tiles ?= 2 +spatz_tests ?= 1 + +LLVM_CMAKE ?= cmake +LLVM_DIR ?= llvm +LLVM_REPO ?= git@github.com:pulp-platform/llvm-project.git +LLVM_COMMIT ?= b494f2d8dde88723026db8ec16ac6c7ee1e140ca +LLVM_INSTALL_DIR ?= $(CURR_DIR)/llvm/install +LLVM_BUILD_DIR ?= $(LLVM_DIR)/llvm-project/build +LLVM_JOBS ?= 8 tiles_2 := $(shell echo $$(( $(tiles) * $(tiles) ))) tiles_log := $(shell awk 'BEGIN { printf "%.0f", log($(tiles_2))/log(2) }') @@ -79,13 +90,13 @@ ifeq ($(compiler), GCC_MULTILIB) sed -i -E 's/^#add_subdirectory\(flatatt\)/add_subdirectory\(flatatt\)/' ./tests/magia/mesh/CMakeLists.txt sed -i -E 's/^\/\/#include "utils\/attention_utils.h"/#include "utils\/attention_utils.h"/' ./targets/$(target_platform)/include/tile.h endif - cmake -DTARGET_PLATFORM=$(target_platform) -DEVAL=$(eval) -DSTALLING=$(stalling) -DFSYNC_MM=$(fsync_mm) -DIDMA_MM=$(idma_mm) -DREDMULE_MM=$(redmule_mm) -DCOMPILER=$(compiler) -DPROFILE_CMP=$(profile_cmp) -DPROFILE_CMI=$(profile_cmi) -DPROFILE_CMO=$(profile_cmo) -DPROFILE_SNC=$(profile_snc) -B build --trace-expand + cmake -DTARGET_PLATFORM=$(target_platform) -DEVAL=$(eval) -DSTALLING=$(stalling) -DFSYNC_MM=$(fsync_mm) -DIDMA_MM=$(idma_mm) -DREDMULE_MM=$(redmule_mm) -DCOMPILER=$(compiler) -DPROFILE_CMP=$(profile_cmp) -DPROFILE_CMI=$(profile_cmi) -DPROFILE_CMO=$(profile_cmo) -DPROFILE_SNC=$(profile_snc) -DSPATZ_TESTS=$(spatz_tests) -DSPATZ_LLVM_PATH=$(LLVM_INSTALL_DIR) -B build --trace-expand cmake --build build --verbose set_mesh: ifeq ($(tiles), 1) $(eval mesh_dv=0) -endif +endif run: set_mesh @echo 'Magia is available at https://github.com/pulp-platform/MAGIA.git' @@ -107,10 +118,10 @@ else ifeq ($(platform), rtl) cp ./build/bin/$(test) $(BUILD_DIR)/build/verif objcopy --srec-len 1 --output-target=srec $(BIN) $(BIN).s19 scripts/parse_s19.pl $(BIN).s19 > $(BIN).txt - python3 scripts/s19tomem.py $(BIN).txt $(BUILD_DIR)/build/stim_instr.txt $(BUILD_DIR)/build/stim_data.txt + python3 scripts/s19tomem.py $(BIN).txt $(BUILD_DIR)/build/stim_instr.txt $(BUILD_DIR)/build/stim_data.txt cd $(BUILD_DIR) && \ cp -sf ../../../sim/modelsim.ini modelsim.ini && \ - ln -sfn ../../../sim/work work + ln -sfn ../../../sim/work work riscv32-unknown-elf-objdump -d -S -Mmarch=$(ISA) $(BIN) > $(BIN).dump riscv32-unknown-elf-objdump -d -l -s -Mmarch=$(ISA) $(BIN) > $(BIN).objdump python3 scripts/objdump2itb.py $(BIN).objdump > $(BIN).itb @@ -120,6 +131,36 @@ else $(error Only rtl and gvsoc are supported as platforms.) endif +run_with_spatz: set_mesh +ifndef test + $(error Proper formatting is: make run_with_spatz test= platform=) +endif +ifeq (,$(wildcard ./build/bin/$(test))) + $(error No test found with name: $(test)) +endif +ifndef platform + $(error Proper formatting is: make run_with_spatz test= platform=rtl|gvsoc) +endif +ifeq ($(platform), gvsoc) + $(GVSOC_DIR)/install/bin/gvrun --target magia_v2 --work-dir $(GVSOC_ABS_PATH)/Documents/test --param binary=$(BIN_ABS_PATH)/$(test) run --attr magia/n_tiles_x=$(tiles) --attr magia/n_tiles_y=$(tiles) --attr magia_v2/spatz_romfile=$(BIN_ABS_PATH)/bootrom/spatz_init.bin +else ifeq ($(platform), rtl) + mkdir -p $(BUILD_DIR_ABS) && cd $(BUILD_DIR_ABS) && mkdir -p build + cp ./build/bin/$(test) $(BUILD_DIR_ABS)/build/verif + objcopy --srec-len 1 --output-target=srec $(BUILD_DIR_ABS)/build/verif $(BUILD_DIR_ABS)/build/verif.s19 + scripts/parse_s19.pl $(BUILD_DIR_ABS)/build/verif.s19 > $(BUILD_DIR_ABS)/build/verif.txt + python3 scripts/s19tomem.py $(BUILD_DIR_ABS)/build/verif.txt $(BUILD_DIR_ABS)/build/stim_instr.txt $(BUILD_DIR_ABS)/build/stim_data.txt + cd $(BUILD_DIR_ABS) && \ + cp -sf "$(MAGIA_DIR_ABS)/sim/modelsim.ini" modelsim.ini && \ + ln -sfn "$(MAGIA_DIR_ABS)/sim/work" work + riscv32-unknown-elf-objdump -d -S -Mmarch=$(ISA) $(BUILD_DIR_ABS)/build/verif > $(BUILD_DIR_ABS)/build/verif.dump + riscv32-unknown-elf-objdump -d -l -s -Mmarch=$(ISA) $(BUILD_DIR_ABS)/build/verif > $(BUILD_DIR_ABS)/build/verif.objdump + python3 scripts/objdump2itb.py $(BUILD_DIR_ABS)/build/verif.objdump > $(BUILD_DIR_ABS)/build/verif.itb + cd $(MAGIA_DIR_ABS) && \ + make run test=$(test) gui=$(gui) mesh_dv=$(mesh_dv) +else + $(error Only rtl and gvsoc are supported as platforms.) +endif + MAGIA: set_mesh ifeq ($(shell expr $(tiles_2) \> 256), 1) $(eval tiles_2=256) @@ -175,4 +216,27 @@ gvsoc_init: cd ../pulp && \ git checkout lz/magia-v2-pulp - +llvm: + mkdir -p $(LLVM_DIR) + if [ ! -d "$(LLVM_DIR)/llvm-project/.git" ]; then \ + cd $(LLVM_DIR) && git clone $(LLVM_REPO); \ + fi + cd $(LLVM_DIR)/llvm-project && \ + git checkout $(LLVM_COMMIT) && \ + git submodule update --init --recursive --jobs=$(LLVM_JOBS) . + mkdir -p $(LLVM_INSTALL_DIR) + cd $(LLVM_DIR)/llvm-project && mkdir -p build && cd build && \ + $(LLVM_CMAKE) \ + -DCMAKE_INSTALL_PREFIX=$(LLVM_INSTALL_DIR) \ + -DCMAKE_CXX_COMPILER=${CXX} \ + -DCMAKE_C_COMPILER=${CC} \ + -DLLVM_OPTIMIZED_TABLEGEN=True \ + -DLLVM_ENABLE_PROJECTS="clang;lld" \ + -DLLVM_TARGETS_TO_BUILD="RISCV" \ + -DLLVM_DEFAULT_TARGET_TRIPLE=riscv32-unknown-elf \ + -DLLVM_ENABLE_LLD=False \ + -DLLVM_APPEND_VC_REV=ON \ + -DCMAKE_BUILD_TYPE=Release \ + ../llvm && \ + make -j$(LLVM_JOBS) all && \ + make install diff --git a/README.md b/README.md index 0ff77d26..05a3c86a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ The following *optional* parameters can be specified when running the make comma `profile_cmp|cmi|cmo|snc`: **0**|**1** (**Default**: 0). Activates the profiling utilities for computing|comunication(input line)|comunication(output line)|synchronization +`spatz_tests`: **0**|**1** (**Default**: 1). Enable compilation of tests with Spatz task (along with default mesh tests) + 0. In case you are using this SDK as non-submodule: Clone the [MAGIA](https://github.com/pulp-platform/MAGIA/tree/main) repository: `git clone git@github.com:pulp-platform/MAGIA.git` @@ -51,9 +53,9 @@ The following *optional* parameters can be specified when running the make comma 1. Initialize the GVSoC submodule: `make gvsoc_init` - + 2. Build the Magia architecture (*this command may take time and return an error, please be patient.*): - + `make MAGIA ` And/Or the GVSoC module: @@ -90,7 +92,7 @@ The following *optional* parameters can be specified when running the make comma `make run test= ` -***WARNING: YOU HAVE TO REBUILD BOTH RTL/GVSOC AND THE TEST BINARY EACH TIME YOU WANT TO TEST A MAGIA MESH WITH A DIFFERENT NUMBER OF TILES.*** +***WARNING: YOU HAVE TO REBUILD BOTH RTL/GVSOC AND THE TEST BINARY EACH TIME YOU WANT TO TEST A MAGIA MESH WITH A DIFFERENT NUMBER OF TILES.*** If you want to run gvsoc or a binary from outside the magia-sdk directory you can edit the **GVSOC_ABS_PATH** and **BIN_ABS_PATH** option in Makefile or directly on the *run* command line. @@ -122,7 +124,7 @@ To add your own test, you have to integrate a new test folder inside the **tests 4. Add to the *\* directory: 1. A new CMakeList.txt file following this template: - + set(TEST_NAME ) file(GLOB_RECURSE TEST_SRCS @@ -142,11 +144,83 @@ To add your own test, you have to integrate a new test folder inside the **tests TARGET ${TEST_NAME} POST_BUILD COMMAND ${CMAKE_OBJDUMP} -dhS -Mmarch=${ISA} $ > $.s) - + 2. An **src** directory containing your test's source (.c) files 3. An **include** directory containing your test's header (.h) files +## Spatz integration in MAGIA + +This SDK provides a flow to compile C code for the Spatz vector accelerator, embed the resulting binary into the main CV32 executable, and manage the execution. This allows the main RISC-V core (CV32) to offload tasks to the Spatz accelerator. + +Examples using this flow are available in the `tests/spatz_on_magia/` directory. Each test sub-folder contains a `main.c` for the CV32 host and a `spatz_task/` directory with the source code for the Spatz accelerator. + +For more informations about hardware integration, configuration parameters, control interface, programming APIs and execution flow please refer to the [MAGIA-Spatz README](https://github.com/pulp-platform/MAGIA/tree/lb/magia-spatz/spatz) + +> **Warning:** The external README linked above is tailored for baremetal hardware development. Some information may overlap or contain minor inaccuracies regarding the specific abstractions and automation provided by this SDK. + +### Prerequisites + +The compilation flow requires a dedicated Spatz LLVM toolchain. +You can install it automatically by running the following command from the SDK root: + +```sh +make llvm +``` +This will clone the required repository and build the toolchain in the `llvm/install` directory. Alternatively, if you have a pre-built toolchain, you can specify its location by passing the `LLVM_INSTALL_DIR` variable to the make command: +```sh +make build LLVM_INSTALL_DIR=/path/to/your/llvm/install +``` + +### Compilation Flow + +The compilation process is managed by two CMake functions defined in `cmake/spatz_helpers.cmake`: `add_spatz_task` and `add_cv32_executable_with_spatz`. + +#### 1. `add_spatz_task` +This function compiles the C code for the Spatz accelerator and prepares it for embedding. + +* **What it does**: + 1. Compiles the Spatz source code into an ELF binary using a dedicated `clang` compiler from the Spatz LLVM toolchain. + 2. Converts the ELF file into a raw binary format (`.bin`). + 3. Uses the `scripts/bin2header.py` script to transform the raw binary into a C header file. This header contains a `uint32_t` array holding the machine code of the Spatz task. This array is placed in a special linker section named `.spatz_binary`. + 4. Runs the `scripts/extract_task_symbols.sh` script to append additional information to the header. This script inspects the Spatz ELF file and extracts the addresses of key symbols, defining them as macros. These symbols include: + * `SPATZ_BINARY_START`: The starting memory address where the Spatz binary will be loaded. This is resolved by the CV32 linker. + * `SPATZ_DISPATCHER_LOOP`: The entry point for the Spatz control loop. + * Task function addresses (e.g., `MY_TASK`): Entry points for specific functions within the Spatz code that can be called from the CV32 host. + +#### 2. `add_cv32_executable_with_spatz` +This function compiles the main application for the CV32 core and embeds the Spatz binary within it. + +* **What it does**: + 1. Compiles the C source code for the CV32 processor. + 2. Includes the header file generated by `add_spatz_task`. By including this header, the Spatz binary (as a C array) becomes part of the CV32 application's source. + 3. Links the compiled CV32 code with the Spatz binary data. The main linker script (`targets/magia_v2/link.ld`) ensures that the `.spatz_binary` section is placed at the correct memory address. + +### Example Usage +To use this flow, you need to call the two functions in your `CMakeLists.txt`. The convention is to have separate sources for the host (CV32) and the accelerator (Spatz). + +Here is an example from `tests/spatz_on_magia/hello_spatz/CMakeLists.txt`: +```cmake +set(TEST_NAME hello_spatz) + +# Step 1: Compile the Spatz task and generate the C header +add_spatz_task( + TEST_NAME ${TEST_NAME} + TASK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spatz_task/hello_task.c + FIRST_TASK_NAME hello_task +) + +# Step 2: Compile the CV32 executable and embed the Spatz binary +add_cv32_executable_with_spatz( + TARGET_NAME ${TEST_NAME} + SPATZ_HEADER ${SPATZ_HEADER} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.c +) +``` + +### Run Tests +To run test a special Makefile rule can be used: `make run_with_spatz test= platform=`. + ## Folder Structure ### README.md @@ -171,7 +245,7 @@ Contains the weak definitions of this SDK APIs. These are the API instruction th Contains the architecture-specific implementation and source code for the HAL APIs. Despite each implementation having different names, thanks to an aliasing system the programmer can use the same name for the same API instruction on different architectures. ### devices -Nothing there. +Nothing there. If MAGIA ever evolves to have a host-offload mechanism, this folder will contain the trampoline functions. @@ -180,4 +254,3 @@ Contains utility files for *cmake* automatic compilation. ### gvsoc A submodule containing the Germain Virtual System on Chip, built to simulate MAGIA (and other PULP-related platforms). - diff --git a/cmake/bootrom_helpers.cmake b/cmake/bootrom_helpers.cmake new file mode 100644 index 00000000..0d4d4c9e --- /dev/null +++ b/cmake/bootrom_helpers.cmake @@ -0,0 +1,43 @@ +# Spatz bootrom compilation helpers + +# add_spatz_bootrom() +# Builds the Spatz bootrom artifacts (ELF/BIN/DUMP). +function(add_spatz_bootrom) + file(MAKE_DIRECTORY "${SPATZ_BOOTROM_OUTPUT_DIR}") + + # Compile bootrom ELF [MAGIA/spatz/bootrom/Makefile: $(ELF)] + add_custom_command( + OUTPUT ${SPATZ_BOOTROM_ELF} + COMMAND ${SPATZ_CLANG} + ${SPATZ_COMPILE_FLAGS} + ${SPATZ_CFLAGS_DEFINES} + ${SPATZ_LINK_FLAGS} + -T${SPATZ_BOOTROM_LINK_SCRIPT} + -o ${SPATZ_BOOTROM_ELF} + ${SPATZ_BOOTROM_SRC} + DEPENDS ${SPATZ_BOOTROM_SRC} ${SPATZ_BOOTROM_LINK_SCRIPT} + COMMENT "[SPATZ-BOOTROM] Compiling bootrom ELF..." + VERBATIM + ) + + # Extract binary [MAGIA/spatz/bootrom/Makefile: $(BIN)] + add_custom_command( + OUTPUT ${SPATZ_BOOTROM_BIN} + COMMAND ${SPATZ_OBJCOPY} -O binary ${SPATZ_BOOTROM_ELF} ${SPATZ_BOOTROM_BIN} + DEPENDS ${SPATZ_BOOTROM_ELF} + COMMENT "[SPATZ-BOOTROM] Generating bootrom binary..." + VERBATIM + ) + + # Generate disassembly [MAGIA/spatz/bootrom/Makefile: $(DUMP)] + add_custom_command( + OUTPUT ${SPATZ_BOOTROM_DUMP} + COMMAND ${SPATZ_OBJDUMP} -D ${SPATZ_BOOTROM_ELF} > ${SPATZ_BOOTROM_DUMP} + DEPENDS ${SPATZ_BOOTROM_ELF} + COMMENT "[SPATZ-BOOTROM] Generating disassembly..." + VERBATIM + ) + + add_custom_target(spatz_bootrom ALL DEPENDS ${SPATZ_BOOTROM_BIN} ${SPATZ_BOOTROM_DUMP}) + set(SPATZ_BOOTROM_BIN ${SPATZ_BOOTROM_BIN} PARENT_SCOPE) +endfunction() diff --git a/cmake/spatz_config.cmake b/cmake/spatz_config.cmake new file mode 100644 index 00000000..801bb350 --- /dev/null +++ b/cmake/spatz_config.cmake @@ -0,0 +1,175 @@ +# Spatz/CV32/Bootrom configuration shared by helper modules. + +# ============================================================================== +# Spatz LLVM Toolchain [MAGIA/spatz/sw/Makefile] +# ============================================================================== +set(SPATZ_LLVM_PATH "$ENV{LLVM_INSTALL_DIR}" CACHE PATH "Path to Spatz LLVM installation") +if(NOT SPATZ_LLVM_PATH) + set(SPATZ_LLVM_PATH "${CMAKE_SOURCE_DIR}/../llvm/install" CACHE PATH "Path to Spatz LLVM installation" FORCE) +endif() +set(SPATZ_CLANG "${SPATZ_LLVM_PATH}/bin/clang" CACHE PATH "Path to Spatz clang") +set(SPATZ_OBJCOPY "${SPATZ_LLVM_PATH}/bin/llvm-objcopy" CACHE PATH "Path to Spatz llvm-objcopy") +set(SPATZ_OBJDUMP "${SPATZ_LLVM_PATH}/bin/llvm-objdump" CACHE PATH "Path to Spatz llvm-objdump") + +# ============================================================================== +# BOOTROM settings (used by add_spatz_bootrom) +# ============================================================================== +set(SPATZ_BOOTROM_SRC "${CMAKE_SOURCE_DIR}/targets/magia_v2/spatz/bootrom/spatz_init.S" CACHE PATH "Spatz bootrom source") +set(SPATZ_BOOTROM_LINK_SCRIPT "${CMAKE_SOURCE_DIR}/targets/magia_v2/spatz/bootrom/spatz_init.ld" CACHE PATH "Spatz bootrom linker script") +set(SPATZ_BOOTROM_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/bootrom") +set(SPATZ_BOOTROM_ELF "${SPATZ_BOOTROM_OUTPUT_DIR}/spatz_init.elf") +set(SPATZ_BOOTROM_BIN "${SPATZ_BOOTROM_OUTPUT_DIR}/spatz_init.bin") +set(SPATZ_BOOTROM_DUMP "${SPATZ_BOOTROM_OUTPUT_DIR}/spatz_init.dump") + +# ============================================================================== +# CV32 settings (used by add_cv32_executable_with_spatz) +# ============================================================================== + +# Paths +set(CV32_CRT0_SRC "${CMAKE_SOURCE_DIR}/targets/magia_v2/src/crt0.S" CACHE PATH "CV32 CRT0 assembly") +set(MAGIA_IO_SRC "${CMAKE_SOURCE_DIR}/targets/magia_v2/src/io.c") +set(MAGIA_TARGET_INCLUDE_DIRS + "${CMAKE_SOURCE_DIR}/targets/magia_v2/include" + "${CMAKE_SOURCE_DIR}/targets/magia_v2/include/utils" + "${CMAKE_SOURCE_DIR}/targets/magia_v2/include/addr_map" + "${CMAKE_SOURCE_DIR}/targets/magia_v2/include/regs" + "${CMAKE_SOURCE_DIR}/tests/common" +) +set(MAGIA_CV32_EXTRA_INCLUDE_DIRS + "${CMAKE_SOURCE_DIR}/hal/include" + "${CMAKE_SOURCE_DIR}/drivers/eventunit32/include" +) + +# ISA setup [MAGIA/Makefile] +set(CV32_ARCH rv CACHE STRING "CV32 ARCH prefix") +set(CV32_XLEN 32 CACHE STRING "CV32 XLEN") +set(CV32_XTEN imcxgap9 CACHE STRING "CV32 ISA extensions") +set(CV32_ABI ilp CACHE STRING "CV32 ABI prefix") +set(CV32_XABI f CACHE STRING "CV32 ABI extension") +set(CV32_MARCH "-march=${CV32_ARCH}${CV32_XLEN}${CV32_XTEN}") +set(CV32_MABI "-mabi=${CV32_ABI}${CV32_XLEN}${CV32_XABI}") + +# Compiler flags [MAGIA/Makefile: CC_OPTS] +set(CV32_COMPILE_FLAGS + ${CV32_MARCH} + ${CV32_MABI} + "-D__riscv__" + "-O2" + "-g" + "-Wall" + "-Wextra" + "-Wno-unused-parameter" + "-Wno-unused-variable" + "-Wno-unused-function" + "-Wundef" + "-fdata-sections" + "-ffunction-sections" + "-MMD" + "-MP" +) + +# Linker flags [MAGIA/Makefile: LD_OPTS] +set(CV32_LINK_FLAGS + ${CV32_MARCH} + ${CV32_MABI} + "-D__riscv__" + "-MMD" + "-MP" + "-nostartfiles" + "-nostdlib" + "-Wl,--gc-sections" +) + +# ============================================================================== +# SPATZ settings (used by add_spatz_task) +# ============================================================================== + +# Paths +set(SPATZ_CRT0_SRC "${CMAKE_SOURCE_DIR}/targets/magia_v2/spatz/src/spatz_crt0.S" CACHE PATH "Spatz CRT0 assembly") +set(SPATZ_LINK_SCRIPT "${CMAKE_SOURCE_DIR}/targets/magia_v2/spatz/src/spatz_program.ld" CACHE PATH "Spatz linker script") + +# Spatz arch configuration options [MAGIA/Makefile] +set(SPATZ_RVD 0 CACHE INT "0: 32-bit TCDM w/ ELEN=32, 1: 64-bit TCDM w/ ELEN=64") +set(SPATZ_VLEN 256 CACHE INT "Vector length in bits (128, 256, 512, ...)") +set(SPATZ_NRVREG 32 CACHE INT "Number of vector registers - RISC-V standar=32") +set(SPATZ_NR_VRF_BANKS 4 CACHE INT "Number of VRF banks (banking parallelism: 2, 4, 8)") +set(SPATZ_N_IPU 1 CACHE INT "Number of Integer Processing Units (1-8)") +set(SPATZ_N_FPU 4 CACHE INT "Number of Floating Point Units (1-8)") +set(SPATZ_NR_PARALLEL_INSTR 4 CACHE INT "Number of parallel vector instructions (scoreboard depth)") +set(SPATZ_XDIVSQRT 0 CACHE INT "0: FP div/sqrt disabled, 1: enabled") +set(SPATZ_XDMA 0 CACHE INT "0: DMA disabled, 1: enabled") +set(SPATZ_RVF 1 CACHE INT "0: single-precision FP disabled, 1: enabled") +set(SPATZ_RVV 1 CACHE INT "0: vector extension disabled, 1: enabled") + +# ISA setup [MAGIA/spatz/sw/Makefile] +set(SPATZ_ARCH rv CACHE STRING "Spatz ARCH prefix") +set(SPATZ_XLEN 32 CACHE STRING "Spatz XLEN") +set(SPATZ_ABI ilp CACHE STRING "Spatz ABI prefix") + +# Build ISA string dynamically [MAGIA/spatz/sw/Makefile] +set(SPATZ_XTEN "ima") +if(SPATZ_RVD) + set(SPATZ_XTEN "${SPATZ_XTEN}fd") + set(SPATZ_XABI "32d") +elseif(SPATZ_RVF) + set(SPATZ_XTEN "${SPATZ_XTEN}f") + set(SPATZ_XABI "32f") +else() + set(SPATZ_XABI "32") +endif() +if(SPATZ_RVV) + set(SPATZ_XTEN "${SPATZ_XTEN}v") +endif() +set(SPATZ_XTEN "${SPATZ_XTEN}_zfh") +set(SPATZ_MARCH "-march=${SPATZ_ARCH}${SPATZ_XLEN}${SPATZ_XTEN}") +set(SPATZ_MABI "-mabi=${SPATZ_ABI}${SPATZ_XABI}") + +# Compiler and linker flags [MAGIA/spatz/sw/Makefile] +set(SPATZ_ARCH_FLAGS + "--target=riscv32" + ${SPATZ_MARCH} + ${SPATZ_MABI} + "-menable-experimental-extensions" +) +set(SPATZ_COMPILE_FLAGS + ${SPATZ_ARCH_FLAGS} + "-static" + "-nostartfiles" + "-nostdlib" + "-O2" + "-g" + "-Wall" + "-Wextra" + "-Wno-incompatible-function-pointer-types" + "-fno-common" + "-ffunction-sections" + "-fdata-sections" + "-fPIC" + "-fno-builtin" + "-mcmodel=medany" +) +set(SPATZ_CFLAGS_DEFINES + "-DSPATZ_RVD=${SPATZ_RVD}" + "-DSPATZ_VLEN=${SPATZ_VLEN}" + "-DSPATZ_N_IPU=${SPATZ_N_IPU}" + "-DSPATZ_N_FPU=${SPATZ_N_FPU}" + "-DSPATZ_XDIVSQRT=${SPATZ_XDIVSQRT}" + "-DSPATZ_XDMA=${SPATZ_XDMA}" + "-DSPATZ_RVF=${SPATZ_RVF}" + "-DSPATZ_RVV=${SPATZ_RVV}" +) +set(SPATZ_LINK_FLAGS + "-fuse-ld=${SPATZ_LLVM_PATH}/bin/ld.lld" + "-Wl,-z,norelro" + "-Wl,--allow-multiple-definition" +) + +# add_spatz_task defaults +set(SPATZ_TASK_DEFINE "-DSPATZ_TARGET") +set(SPATZ_TASK_OUTPUT_ROOT "${CMAKE_BINARY_DIR}/bin/spatz_on_magia") +set(SPATZ_TASK_BIN2HEADER_SCRIPT "${CMAKE_SOURCE_DIR}/scripts/bin2header.py") +set(SPATZ_TASK_EXTRACT_SYMBOLS_SCRIPT "${CMAKE_SOURCE_DIR}/scripts/extract_task_symbols.sh") +set(SPATZ_TASK_HEADER_SECTION ".spatz_binary") +set(SPATZ_TASK_HEADER_ADDRESS "dynamic (_spatz_binary_start)") + +message(STATUS "Spatz Configuration: LLVM=${SPATZ_LLVM_PATH}, ISA=rv32${SPATZ_XTEN}, VLEN=${SPATZ_VLEN}") diff --git a/cmake/spatz_helpers.cmake b/cmake/spatz_helpers.cmake new file mode 100644 index 00000000..ecc72258 --- /dev/null +++ b/cmake/spatz_helpers.cmake @@ -0,0 +1,202 @@ +# Helpers for building Spatz tasks and CV32 executables that embed them. + +# add_spatz_task( +# TEST_NAME +# TASK_SOURCES +# [FIRST_TASK_NAME ] +# [INCLUDE_DIRS ] +# ) +# Builds a Spatz task ELF/BIN/DUMP, generates _task_bin.h and exports +# per-test variables (_SPATZ_HEADER, _TASK_BIN, ...). +function(add_spatz_task) + set(options) + set(oneValueArgs TEST_NAME FIRST_TASK_NAME) + set(multiValueArgs TASK_SOURCES INCLUDE_DIRS) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_TEST_NAME) + message(FATAL_ERROR "add_spatz_task requires TEST_NAME") + endif() + if(NOT ARG_TASK_SOURCES) + message(FATAL_ERROR "add_spatz_task(${ARG_TEST_NAME}) requires TASK_SOURCES") + endif() + if(NOT ARG_FIRST_TASK_NAME) + set(ARG_FIRST_TASK_NAME "${ARG_TEST_NAME}_task") + endif() + + # -------------------------------------------------------------------------- + # Paths and names + # -------------------------------------------------------------------------- + set(SPATZ_OUTPUT_DIR "${SPATZ_TASK_OUTPUT_ROOT}/${ARG_TEST_NAME}/spatz_task") + file(MAKE_DIRECTORY "${SPATZ_OUTPUT_DIR}") + + string(REGEX MATCH "_task$" HAS_TASK_SUFFIX "${ARG_TEST_NAME}") + if(HAS_TASK_SUFFIX) + set(FILE_PREFIX "${ARG_TEST_NAME}") + else() + set(FILE_PREFIX "${ARG_TEST_NAME}_task") + endif() + + set(TASK_CRT0_OBJ "${SPATZ_OUTPUT_DIR}/${FILE_PREFIX}_crt0.o") + set(TASK_ELF "${SPATZ_OUTPUT_DIR}/${FILE_PREFIX}.elf") + set(TASK_BIN "${SPATZ_OUTPUT_DIR}/${FILE_PREFIX}.bin") + set(TASK_DUMP "${SPATZ_OUTPUT_DIR}/${FILE_PREFIX}.dump") + set(TASK_HEADER "${SPATZ_OUTPUT_DIR}/${FILE_PREFIX}_bin.h") + + set(TASK_INCLUDE_FLAGS "") + foreach(INCLUDE_DIR ${MAGIA_TARGET_INCLUDE_DIRS}) + list(APPEND TASK_INCLUDE_FLAGS "-I${INCLUDE_DIR}") + endforeach() + foreach(INCLUDE_DIR ${ARG_INCLUDE_DIRS}) + list(APPEND TASK_INCLUDE_FLAGS "-I${INCLUDE_DIR}") + endforeach() + + # -------------------------------------------------------------------------- + # Custom commands + # -------------------------------------------------------------------------- + + # Compile crt0.S [MAGIA/spatz/sw/Makefile: $(CRT0_OBJ)] + add_custom_command( + OUTPUT ${TASK_CRT0_OBJ} + COMMAND ${SPATZ_CLANG} + ${SPATZ_ARCH_FLAGS} + -c -o ${TASK_CRT0_OBJ} + ${SPATZ_CRT0_SRC} + DEPENDS ${SPATZ_CRT0_SRC} + COMMENT "[SPATZ] Compiling crt0..." + VERBATIM + ) + + # Build ELF [MAGIA/spatz/sw/Makefile: $(ELF)] + add_custom_command( + OUTPUT ${TASK_ELF} + COMMAND ${SPATZ_CLANG} + ${SPATZ_COMPILE_FLAGS} + ${SPATZ_CFLAGS_DEFINES} + ${SPATZ_TASK_DEFINE} + ${TASK_INCLUDE_FLAGS} + ${SPATZ_LINK_FLAGS} + -T${SPATZ_LINK_SCRIPT} + -Wl,--defsym,__first_task=${ARG_FIRST_TASK_NAME} + -o ${TASK_ELF} + ${TASK_CRT0_OBJ} + ${MAGIA_IO_SRC} + ${ARG_TASK_SOURCES} + DEPENDS + ${TASK_CRT0_OBJ} + ${MAGIA_IO_SRC} + ${ARG_TASK_SOURCES} + ${SPATZ_LINK_SCRIPT} + COMMENT "[SPATZ] Building ELF..." + VERBATIM + ) + + # Generate binary [MAGIA/spatz/sw/Makefile: $(BIN)] + add_custom_command( + OUTPUT ${TASK_BIN} + COMMAND ${SPATZ_OBJCOPY} -O binary ${TASK_ELF} ${TASK_BIN} + DEPENDS ${TASK_ELF} + COMMENT "[SPATZ] Generating binary..." + VERBATIM + ) + + # Generate disassembly [MAGIA/spatz/sw/Makefile: $(DUMP)] + add_custom_command( + OUTPUT ${TASK_DUMP} + COMMAND ${SPATZ_OBJDUMP} -D -S ${TASK_ELF} > ${TASK_DUMP} + DEPENDS ${TASK_ELF} + COMMENT "[SPATZ] Generating disassembly..." + VERBATIM + ) + + # Generate header [MAGIA/spatz/sw/Makefile: $(HEADER)] + add_custom_command( + OUTPUT ${TASK_HEADER} + COMMAND python3 ${SPATZ_TASK_BIN2HEADER_SCRIPT} + ${TASK_BIN} ${TASK_HEADER} + --name ${ARG_TEST_NAME}_task_bin + --section ${SPATZ_TASK_HEADER_SECTION} + --address "${SPATZ_TASK_HEADER_ADDRESS}" + COMMAND bash ${SPATZ_TASK_EXTRACT_SYMBOLS_SCRIPT} + ${ARG_TEST_NAME} ${TASK_ELF} ${TASK_HEADER} ${SPATZ_OBJDUMP} + DEPENDS + ${TASK_BIN} + ${TASK_ELF} + ${SPATZ_TASK_BIN2HEADER_SCRIPT} + ${SPATZ_TASK_EXTRACT_SYMBOLS_SCRIPT} + COMMENT "[SPATZ] Generating header and extracting task symbols..." + VERBATIM + ) + + # -------------------------------------------------------------------------- + # Target and exported variables + # -------------------------------------------------------------------------- + add_custom_target(${ARG_TEST_NAME}_spatz_header ALL + DEPENDS + ${TASK_HEADER} + ${TASK_BIN} + ${TASK_DUMP} + ) + + set(${ARG_TEST_NAME}_SPATZ_HEADER ${TASK_HEADER} PARENT_SCOPE) + set(${ARG_TEST_NAME}_TASK_BIN ${TASK_BIN} PARENT_SCOPE) + set(${ARG_TEST_NAME}_TASK_HEADER ${TASK_HEADER} PARENT_SCOPE) + set(${ARG_TEST_NAME}_SPATZ_OUTPUT_DIR ${SPATZ_OUTPUT_DIR} PARENT_SCOPE) +endfunction() + +# add_cv32_executable_with_spatz( +# TARGET_NAME +# SOURCES +# [INCLUDE_DIRS ] +# ) +# Builds a CV32 executable linked with runtime/hal. +# Requires `add_spatz_task(TEST_NAME )` to be called first in the +# same CMake scope. +function(add_cv32_executable_with_spatz) + set(options) + set(oneValueArgs TARGET_NAME) + set(multiValueArgs SOURCES INCLUDE_DIRS) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_TARGET_NAME) + message(FATAL_ERROR "add_cv32_executable_with_spatz requires TARGET_NAME") + endif() + if(NOT ARG_SOURCES) + message(FATAL_ERROR "add_cv32_executable_with_spatz(${ARG_TARGET_NAME}) requires SOURCES") + endif() + if(NOT DEFINED ${ARG_TARGET_NAME}_SPATZ_HEADER) + message(FATAL_ERROR "add_cv32_executable_with_spatz(${ARG_TARGET_NAME}) requires add_spatz_task(TEST_NAME ${ARG_TARGET_NAME}) first.") + endif() + + # -------------------------------------------------------------------------- + # Target definition + # -------------------------------------------------------------------------- + add_executable(${ARG_TARGET_NAME} + ${CV32_CRT0_SRC} + ${ARG_SOURCES} + ${MAGIA_IO_SRC} + ) + + get_filename_component(SPATZ_HEADER_DIR "${${ARG_TARGET_NAME}_SPATZ_HEADER}" DIRECTORY) + target_include_directories(${ARG_TARGET_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/inc + ${MAGIA_TARGET_INCLUDE_DIRS} + ${MAGIA_CV32_EXTRA_INCLUDE_DIRS} + ${ARG_INCLUDE_DIRS} + ${SPATZ_HEADER_DIR} + ) + + target_compile_options(${ARG_TARGET_NAME} PRIVATE ${CV32_COMPILE_FLAGS}) + target_link_options(${ARG_TARGET_NAME} PRIVATE ${CV32_LINK_FLAGS}) + target_link_libraries(${ARG_TARGET_NAME} PUBLIC runtime hal) + + # -------------------------------------------------------------------------- + # Post-build dump + # -------------------------------------------------------------------------- + set(ELF_DUMP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ARG_TARGET_NAME}.s") + add_custom_command(TARGET ${ARG_TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_OBJDUMP} -D -S $ > ${ELF_DUMP} + VERBATIM + ) +endfunction() diff --git a/drivers/eventunit32/src/eventunit32.c b/drivers/eventunit32/src/eventunit32.c index fa51e7de..4669e045 100644 --- a/drivers/eventunit32/src/eventunit32.c +++ b/drivers/eventunit32/src/eventunit32.c @@ -24,7 +24,7 @@ void eu32_init(eu_controller_t *ctrl) { // Clear all pending events mmio32(EU_CORE_BUFFER_CLEAR) = 0xFFFFFFFF; - + // Reset masks to default (disabled) mmio32(EU_CORE_MASK) = 0x00000000; mmio32(EU_CORE_IRQ_MASK) = 0x00000000; @@ -41,7 +41,7 @@ void eu32_init(eu_controller_t *ctrl) { void eu32_redmule_init(eu_controller_t *ctrl, uint32_t enable_irq) { // Enable RedMulE events in mask eu_enable_events(EU_REDMULE_ALL_MASK); - + // Optionally enable IRQ for RedMulE completion if (enable_irq) { eu_enable_irq(EU_REDMULE_DONE_MASK); @@ -78,7 +78,7 @@ uint32_t eu32_redmule_is_done(eu_controller_t *ctrl) { } //============================================================================= -// iDMA-specific Event Functions +// iDMA-specific Event Functions //============================================================================= /** @@ -88,7 +88,7 @@ uint32_t eu32_redmule_is_done(eu_controller_t *ctrl) { void eu32_idma_init(eu_controller_t *ctrl, uint32_t enable_irq) { // Enable iDMA events in mask (both directions) eu_enable_events(EU_IDMA_ALL_MASK); - + // Optionally enable IRQ for iDMA completion (both directions) if (enable_irq) { eu_enable_irq(EU_IDMA_ALL_DONE_MASK); @@ -138,7 +138,7 @@ uint32_t eu32_idma_wait_a2o(eu_controller_t *ctrl, eu_wait_mode_t mode) { } /** - * @brief Wait for L1->L2 (OBI2AXI) completion specifically + * @brief Wait for L1->L2 (OBI2AXI) completion specifically * @param mode Wait mode (polling, WFE, etc.) * @return Non-zero if L1->L2 completed, 0 if timeout/error */ @@ -235,7 +235,7 @@ uint32_t eu32_idma_o2a_is_busy(eu_controller_t *ctrl) { void eu32_fsync_init(eu_controller_t *ctrl, uint32_t enable_irq) { // Enable FSync events in mask (bits 25:24) eu_enable_events(EU_FSYNC_ALL_MASK); - + // Optionally enable IRQ for FSync completion (bit 24) if (enable_irq) { eu_enable_irq(EU_FSYNC_DONE_MASK); @@ -271,12 +271,49 @@ uint32_t eu32_fsync_has_error(eu_controller_t *ctrl) { return eu_check_events(EU_FSYNC_ERROR_MASK); } +//============================================================================= +// Spatz-specific Event Functions +//============================================================================= + +/** + * @brief Initialize Event Unit for Spatz events + * @param enable_irq If true, enable IRQ for Spatz completion + */ +void eu32_spatz_init(eu_controller_t *ctrl, uint32_t enable_irq) { + eu_enable_events(EU_SPATZ_ALL_MASK); + + if (enable_irq) { + eu_enable_irq(EU_SPATZ_DONE_MASK); + } +} + +/** + * @brief Wait for Spatz completion using specific mode + * @param mode Wait mode (polling, WFE, etc.) + * @return Non-zero if FSync completed, 0 if timeout/error + */ +uint32_t eu32_spatz_wait(eu_controller_t *ctrl, eu_wait_mode_t mode) { + uint32_t retval = eu_wait_events(EU_SPATZ_DONE_MASK, mode, 1000000); + #if PROFILE_SNC == 1 + stnl_snc_f(); + #endif + return retval; // 1M cycle timeout +} + +/** + * @brief Check if Spatz has completed, non-blocking + * @return Non-zero if Spatz completed + */ +uint32_t eu32_spatz_is_done(eu_controller_t *ctrl) { + return eu_check_events(EU_SPATZ_DONE_MASK); +} + extern void eu_init(eu_controller_t *ctrl) __attribute__((alias("eu32_init"), used, visibility("default"))); extern void eu_redmule_init(eu_controller_t *ctrl, uint32_t enable_irq) __attribute__((alias("eu32_redmule_init"), used, visibility("default"))); extern uint32_t eu_redmule_wait(eu_controller_t *ctrl, eu_wait_mode_t mode) - __attribute__((alias("eu32_redmule_wait"), used, visibility("default"))); + __attribute__((alias("eu32_redmule_wait"), used, visibility("default"))); extern uint32_t eu_redmule_is_busy(eu_controller_t *ctrl) __attribute__((alias("eu32_redmule_is_busy"), used, visibility("default"))); extern uint32_t eu_redmule_is_done(eu_controller_t *ctrl) @@ -315,6 +352,12 @@ extern uint32_t eu_fsync_is_done(eu_controller_t *ctrl) __attribute__((alias("eu32_fsync_is_done"), used, visibility("default"))); extern uint32_t eu_fsync_has_error(eu_controller_t *ctrl) __attribute__((alias("eu32_fsync_has_error"), used, visibility("default"))); +extern void eu_spatz_init(eu_controller_t *ctrl, uint32_t enable_irq) + __attribute__((alias("eu32_spatz_init"), used, visibility("default"))); +extern uint32_t eu_spatz_wait(eu_controller_t *ctrl, eu_wait_mode_t mode) + __attribute__((alias("eu32_spatz_wait"), used, visibility("default"))); +extern uint32_t eu_spatz_is_done(eu_controller_t *ctrl) + __attribute__((alias("eu32_spatz_is_done"), used, visibility("default"))); eu_controller_api_t eu_api = { .init = eu32_init, @@ -339,4 +382,7 @@ eu_controller_api_t eu_api = { .fsync_wait = eu32_fsync_wait, .fsync_is_done = eu32_fsync_is_done, .fsync_has_error = eu32_fsync_has_error, -}; \ No newline at end of file + .spatz_init = eu32_spatz_init, + .spatz_wait = eu32_spatz_wait, + .spatz_is_done = eu32_spatz_is_done, +}; diff --git a/hal/include/eventunit.h b/hal/include/eventunit.h index c6a1888a..35754723 100644 --- a/hal/include/eventunit.h +++ b/hal/include/eventunit.h @@ -71,7 +71,7 @@ extern uint32_t eu_redmule_is_busy(eu_controller_t *ctrl); extern uint32_t eu_redmule_is_done(eu_controller_t *ctrl); //============================================================================= -// iDMA-specific Event Functions +// iDMA-specific Event Functions //============================================================================= /** @@ -103,7 +103,7 @@ extern uint32_t eu_idma_wait_direction(eu_controller_t *ctrl, uint32_t direction extern uint32_t eu_idma_wait_a2o(eu_controller_t *ctrl, eu_wait_mode_t mode); /** - * @brief Wait for L1->L2 (OBI2AXI) completion specifically + * @brief Wait for L1->L2 (OBI2AXI) completion specifically * @param mode Wait mode (polling, WFE, etc.) * @return Non-zero if L1->L2 completed, 0 if timeout/error */ @@ -192,10 +192,30 @@ extern uint32_t eu_fsync_is_done(eu_controller_t *ctrl); */ extern uint32_t eu_fsync_has_error(eu_controller_t *ctrl); +//============================================================================= +// Spatz-specific Event Functions +//============================================================================= + +/** + * @brief Initialize Event Unit for Spatz events + */ +extern void eu_spatz_init(eu_controller_t *ctrl, uint32_t enable_irq); + +/** + * @brief Wait for Spatz completion in WFE mode + */ +extern uint32_t eu_spatz_wait(eu_controller_t *ctrl, eu_wait_mode_t mode); + +/** + * @brief Check if Spatz has completed, non-blocking + * @return Non-zero if Spatz completed + */ +extern uint32_t eu_spatz_is_done(eu_controller_t *ctrl); + struct eu_controller_api { void (*init) (eu_controller_t *ctrl); void (*redmule_init) (eu_controller_t *ctrl, uint32_t enable_irq); - uint32_t (*redmule_wait) (eu_controller_t *ctrl, eu_wait_mode_t mode); + uint32_t (*redmule_wait) (eu_controller_t *ctrl, eu_wait_mode_t mode); uint32_t (*redmule_is_busy) (eu_controller_t *ctrl); uint32_t (*redmule_is_done) (eu_controller_t *ctrl); void (*idma_init) (eu_controller_t *ctrl, uint32_t enable_irq); @@ -215,6 +235,9 @@ struct eu_controller_api { uint32_t (*fsync_wait) (eu_controller_t *ctrl, eu_wait_mode_t mode); uint32_t (*fsync_is_done) (eu_controller_t *ctrl); uint32_t (*fsync_has_error) (eu_controller_t *ctrl); + void (*spatz_init) (eu_controller_t *ctrl, uint32_t enable_irq); + void (*spatz_wait) (eu_controller_t *ctrl, eu_wait_mode_t mode); + uint32_t (*spatz_is_done) (eu_controller_t *ctrl); }; /* @@ -222,4 +245,4 @@ struct eu_controller_api { */ extern eu_controller_api_t eu_api; -#endif // HAL_EU_H \ No newline at end of file +#endif // HAL_EU_H diff --git a/hal/src/eventunit.c b/hal/src/eventunit.c index f0c064ce..cd768d5e 100644 --- a/hal/src/eventunit.c +++ b/hal/src/eventunit.c @@ -32,4 +32,7 @@ __attribute__((weak)) eu_controller_api_t eu_api = { .fsync_wait = eu_fsync_wait, .fsync_is_done = eu_fsync_is_done, .fsync_has_error = eu_fsync_has_error, -}; \ No newline at end of file + .spatz_init = eu_spatz_init, + .spatz_wait = eu_spatz_wait, + .spatz_is_done = eu_spatz_is_done, +}; diff --git a/scripts/bin2header.py b/scripts/bin2header.py new file mode 100755 index 00000000..41955778 --- /dev/null +++ b/scripts/bin2header.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +""" +Convert binary file to C header with embedded array. +Generates a header with the binary as uint32_t array in custom linker section. +""" + +import argparse + +def bytes_to_words(data): + """Convert bytes to uint32_t words (little-endian).""" + words = [] + for i in range(0, len(data), 4): + # Read up to 4 bytes, pad with zeros if needed + chunk = data[i:i+4] + word = sum(byte << (8 * j) for j, byte in enumerate(chunk)) + words.append(f"0x{word:08X}") + return words + +def generate_header(binary_path, output_path, array_name, section_name, address): + """Generate C header with binary array in custom section.""" + + # Read binary file + with open(binary_path, 'rb') as f: + data = f.read() + + # Convert to words + words = bytes_to_words(data) + guard = f"__{array_name.upper()}_H__" + + # Write header file + with open(output_path, 'w') as f: + # Header guard and includes + f.write(f"/* Auto-generated from {binary_path} ({len(data)} bytes) */\n") + f.write(f"#ifndef {guard}\n") + f.write(f"#define {guard}\n\n") + f.write(f"#include \n\n") + + # Binary array with section attribute + f.write(f"/* Binary array in {section_name} section (target: {address}) */\n") + f.write(f"const uint32_t {array_name}[] ") + f.write(f"__attribute__((section(\"{section_name}\"), aligned(4), used)) = {{\n") + + # Write words (8 per line for readability) + for i in range(0, len(words), 8): + line = words[i:i+8] + f.write(" " + ", ".join(line)) + f.write(",\n" if i + 8 < len(words) else "\n") + + f.write("};\n\n") + f.write(f"#endif /* {guard} */\n") + + print(f"Generated: {output_path} ({len(data)} bytes = {len(words)} words)") + +def main(): + parser = argparse.ArgumentParser(description='Convert binary to C header') + parser.add_argument('binary', help='Input binary file') + parser.add_argument('output', help='Output header file') + parser.add_argument('--name', default='spatz_program', help='Array name') + parser.add_argument('--section', default='.spatz_binary', help='Linker section name') + parser.add_argument('--address', default='dynamic (_spatz_binary_start)', + help='Target address (informational)') + + args = parser.parse_args() + generate_header(args.binary, args.output, args.name, args.section, args.address) + +if __name__ == '__main__': + main() diff --git a/scripts/extract_task_symbols.sh b/scripts/extract_task_symbols.sh new file mode 100755 index 00000000..83e15a88 --- /dev/null +++ b/scripts/extract_task_symbols.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Extract task symbols from ELF and append to task header +# Usage: extract_task_symbols.sh + +set -e + +TEST_NAME=$1 +TASK_ELF=$2 +TASK_HEADER=$3 +OBJDUMP=$4 + +GUARD_NAME=$(echo "${TEST_NAME}_TASK_BIN" | tr 'a-z' 'A-Z') + +# Remove existing #endif from header +sed -i "/#endif.*__${GUARD_NAME}_H__/d" "${TASK_HEADER}" + +# Add binary start address +echo "" >> "${TASK_HEADER}" +echo "/* Binary start address - defined by CV32 linker */" >> "${TASK_HEADER}" +echo "extern uint32_t _spatz_binary_start;" >> "${TASK_HEADER}" +echo "#define SPATZ_BINARY_START ((uint32_t)&_spatz_binary_start)" >> "${TASK_HEADER}" + +# Add dispatcher loop address +echo "" >> "${TASK_HEADER}" +echo "/* Dispatcher loop address - for spatz_run() */" >> "${TASK_HEADER}" +DISP_ADDR=$("${OBJDUMP}" -t "${TASK_ELF}" | grep 'dispatcher_loop' | awk '{print $1}' || echo "0") +echo "#define SPATZ_DISPATCHER_LOOP (SPATZ_BINARY_START + 0x${DISP_ADDR})" >> "${TASK_HEADER}" + +# Add task function entry points +echo "" >> "${TASK_HEADER}" +echo "/* Task function entry points - OFFSETS from SPATZ_BINARY_START */" >> "${TASK_HEADER}" +# Find all global functions with 'task' in their name +"${OBJDUMP}" -t "${TASK_ELF}" | grep -E "F .text.*task" | awk '{print $1, $NF}' | while read addr name; do + # Skip __first_task (that's an internal symbol) + if [[ "$name" != "__first_task" ]]; then + TASK_NAME=$(echo "$name" | tr 'a-z' 'A-Z') + echo "#define ${TASK_NAME} (SPATZ_BINARY_START + 0x${addr})" >> "${TASK_HEADER}" + fi +done + +# Close header guard +echo "" >> "${TASK_HEADER}" +echo "#endif /* __${GUARD_NAME}_H__ */" >> "${TASK_HEADER}" diff --git a/scripts/generate_spatz_bootrom.py b/scripts/generate_spatz_bootrom.py new file mode 100755 index 00000000..e6a7898f --- /dev/null +++ b/scripts/generate_spatz_bootrom.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +# Copyright 2024 ETH Zurich and University of Bologna. +# Solderpad Hardware License, Version 0.51, see LICENSE for details. +# SPDX-License-Identifier: SHL-0.51 +# +# Generate SystemVerilog bootrom module from binary file + +import argparse +import sys + +def generate_bootrom_sv(bin_file, output_file): + """Generate SystemVerilog bootrom module from binary file.""" + + # Read binary file + with open(bin_file, 'rb') as f: + data = f.read() + + # Pad to 32-bit word boundary + if len(data) % 4 != 0: + padding = 4 - (len(data) % 4) + data = data + b'\x00' * padding + + num_bytes = len(data) + num_words = num_bytes // 4 + + # Convert bytes to 32-bit words (little-endian, in address order) + words = [] + for i in range(0, num_bytes, 4): + word = int.from_bytes(data[i:i+4], byteorder='little') + words.append(word) + + # Generate SystemVerilog module (like spatz_cluster) + sv_content = f'''// Copyright 2024 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Auto-generated bootrom for Spatz core complex +// Generated from: {bin_file} +// Size: {num_bytes} bytes ({num_words} words) + +module spatz_bootrom #( + parameter int unsigned DataWidth = 32, + parameter int unsigned AddrWidth = 32 +) ( + input logic clk_i, + input logic req_i, + input logic [AddrWidth-1:0] addr_i, + output logic [DataWidth-1:0] rdata_o +); + localparam int RomSize = {num_words}; + localparam int AddrBits = RomSize > 1 ? $clog2(RomSize) : 1; + + const logic [RomSize-1:0][DataWidth-1:0] mem = {{ +''' + + # Add ROM content in REVERSE order (high index first) + # This is because packed arrays fill from high to low index + for i in range(num_words - 1, -1, -1): + sv_content += f" 32'h{words[i]:08x}" + if i > 0: + sv_content += "," + sv_content += "\n" + + sv_content += ''' }; + + // Combinatorial read - no flop to avoid 1-cycle delay + logic [AddrBits-1:0] addr_idx; + assign addr_idx = addr_i[AddrBits-1+2:2]; + + // Return data immediately based on address + assign rdata_o = (addr_idx < RomSize) ? mem[addr_idx] : '0; +endmodule +''' + + # Write output file + with open(output_file, 'w') as f: + f.write(sv_content) + + print(f"Generated {output_file}: {num_words} words ({num_bytes} bytes)") + +def main(): + parser = argparse.ArgumentParser(description='Generate SystemVerilog bootrom from binary') + parser.add_argument('binary', help='Input binary file') + parser.add_argument('-o', '--output', required=True, help='Output SystemVerilog file') + + args = parser.parse_args() + + try: + generate_bootrom_sv(args.binary, args.output) + except Exception as e: + print(f"Error: {e}", file=sys.stderr) + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/scripts/parse_s19.pl b/scripts/parse_s19.pl index 7f7aff62..7daa6be2 100755 --- a/scripts/parse_s19.pl +++ b/scripts/parse_s19.pl @@ -137,7 +137,7 @@ sub hex2int { # sub int2hex { my $i=shift; # read in the integer - my $h; # define hex value + my $h=""; # define hex value for my $n (0..7){ # 8 digits my $e=16 ** (7-$n); # calculate exponent if ($e > $i){ # if 2^e is larger @@ -175,4 +175,4 @@ sub pad_data64 { } my $ret=$hi.$lo; # merge to one string return $ret; -} \ No newline at end of file +} diff --git a/scripts/s19tomem.py b/scripts/s19tomem.py index 59257728..9ee9475e 100755 --- a/scripts/s19tomem.py +++ b/scripts/s19tomem.py @@ -19,15 +19,15 @@ import sys # Instructions start at 0xcc00_0000 -# Data starts at 0xcc10_0000 +# Data starts at 0xcc01_0000 # Stack starts at 0x0001_0000 # We only keep last 2 bytes so memory will be filled with no offset. # The CPU will also reference it as to not have any offset. MEM_START = 0xcc000000 INSTR_SIZE = 0x8000 INSTR_END = MEM_START + INSTR_SIZE -DATA_BASE = MEM_START + 0x100000 -DATA_SIZE = 0xf00000 +DATA_BASE = MEM_START + 0x10000 +DATA_SIZE = 0x30000 DATA_END = DATA_BASE + DATA_SIZE STACK_BASE = 0x10000 STACK_SIZE = 0x10000 @@ -80,20 +80,16 @@ instr_mem[int(rel_imem_addr) + 6] = whhl instr_mem[int(rel_imem_addr) + 7] = whhh -f = open(instr_txt, "w") -s = "@%08x\n" % MEM_START -f.write(s) - +s = "" +s += "@%08x\n" % MEM_START for m in instr_mem: - s = "%02x\n" % m + s += "%02x\n" % m +with open(instr_txt, "w") as f: f.write(s) -f.close() - -f = open(data_txt, "w") -s = "@%08x\n" % DATA_BASE -f.write(s) +s = "" +s += "@%08x\n" % DATA_BASE for m in data_mem: - s = "%02x\n" % m - f.write(s) -f.close() \ No newline at end of file + s += "%02x\n" % m +with open(data_txt, "w") as f: + f.write(s.rstrip('\n')) diff --git a/targets/magia_v2/CMakeLists.txt b/targets/magia_v2/CMakeLists.txt index 94a77028..4e6a054a 100644 --- a/targets/magia_v2/CMakeLists.txt +++ b/targets/magia_v2/CMakeLists.txt @@ -66,4 +66,9 @@ target_link_options(runtime -Wno-incompatible-pointer-types #ZL-MOD 03072025 -Wno-int-conversion #ZL-MOD 03072025 -Wl,--gc-sections #ZL-MOD 03072025 -) \ No newline at end of file +) + +# Build bootrom only when Spatz tests are enabled. +if(SPATZ_TESTS) + add_spatz_bootrom() +endif() diff --git a/targets/magia_v2/include/addr_map/tile_addr_map.h b/targets/magia_v2/include/addr_map/tile_addr_map.h index aad50ee4..a81dc8f5 100644 --- a/targets/magia_v2/include/addr_map/tile_addr_map.h +++ b/targets/magia_v2/include/addr_map/tile_addr_map.h @@ -17,7 +17,7 @@ * Authors: Victor Isachi * Alberto Dequino * Luca Balboni - * + * * MAGIA Tile Address Map */ @@ -39,8 +39,10 @@ #define FSYNC_END (0x000006FF) #define EU_BASE (0x00000700) #define EU_END (0x000016FF) -#define RESERVED_START (0x00001700) -#define RESERVED_END (0x0000FFFF) +#define SPATZ_CTRL_BASE (0x00001700) +#define SPATZ_CTRL_END (0x000017FF) +#define RESERVED_START (0x00001800) +#define RESERVED_END (0x0000FFFF) #define STACK_START (0x00010000) #define STACK_END (0x0001FFFF) #define L1_BASE (0x00020000) @@ -54,11 +56,11 @@ #define IDMA_BASE_AXI2OBI (IDMA_BASE) // direction=0, L2 to L1 #define IDMA_BASE_OBI2AXI (IDMA_BASE + 0x200) // direction=1, L1 to L2 -#define MESH_X_TILES 2 -#define MESH_Y_TILES 2 +#define MESH_X_TILES 1 +#define MESH_Y_TILES 1 #define NUM_HARTS (MESH_X_TILES*MESH_Y_TILES) -#define MAX_SYNC_LVL 2 -#define MESH_2_POWER 1 +#define MAX_SYNC_LVL 0 +#define MESH_2_POWER 0 #define STR_OFFSET (0x00000000) #define STR_BASE (RESERVED_START + STR_OFFSET) @@ -114,4 +116,4 @@ // Hardware mutex registers (0x04 * mutex_id offset) #define EU_CORE_HW_MUTEX (EU_BASE + 0x0C0) // R/W: HW mutex management -#endif // _TILE_ADDR_MAP_INCLUDE_GUARD_ \ No newline at end of file +#endif // _TILE_ADDR_MAP_INCLUDE_GUARD_ diff --git a/targets/magia_v2/include/regs/tile_ctrl.h b/targets/magia_v2/include/regs/tile_ctrl.h index d4db7304..c3a6ed52 100644 --- a/targets/magia_v2/include/regs/tile_ctrl.h +++ b/targets/magia_v2/include/regs/tile_ctrl.h @@ -17,7 +17,7 @@ * Authors: Victor Isachi * Alberto Dequino * Luca Balboni - * + * * MAGIA Tile Control registers and IRQ */ @@ -50,7 +50,7 @@ #define EU_DMA_EVT_1_BIT (3) // DMA event 1 (error/status) #define EU_DMA_EVT_MASK (0x0000000C) // bits 3:2 -// Timer Events [5:4] - timer_events_i mapping +// Timer Events [5:4] - timer_events_i mapping #define EU_TIMER_EVT_0_BIT (4) // Timer event 0 #define EU_TIMER_EVT_1_BIT (5) // Timer event 1 #define EU_TIMER_EVT_MASK (0x00000030) // bits 5:4 @@ -88,7 +88,7 @@ // iDMA extended status via cluster events [31:26] #define EU_IDMA_A2O_ERROR_BIT (26) // iDMA AXI2OBI error -#define EU_IDMA_O2A_ERROR_BIT (27) // iDMA OBI2AXI error +#define EU_IDMA_O2A_ERROR_BIT (27) // iDMA OBI2AXI error #define EU_IDMA_A2O_START_BIT (28) // iDMA AXI2OBI start #define EU_IDMA_O2A_START_BIT (29) // iDMA OBI2AXI start #define EU_IDMA_A2O_BUSY_BIT (30) // iDMA AXI2OBI busy @@ -119,15 +119,22 @@ #define EU_SYNC_EVT_MASK (0x00000001) // bit 0 #define EU_DISPATCH_EVT_MASK (0x00000002) // bit 1 +// Spatz events (accelerator events [8] + cluster events [23]) +#define EU_SPATZ_DONE_BIT (8) // Spatz completion event (acc_events_array[0][0]) +#define EU_SPATZ_START_BIT (23) // Spatz start trigger event (other_events_array[0][23]) +#define EU_SPATZ_DONE_MASK (1 << EU_SPATZ_DONE_BIT) // 0x100 +#define EU_SPATZ_START_MASK (1 << EU_SPATZ_START_BIT) // 0x800000 +#define EU_SPATZ_ALL_MASK (EU_SPATZ_DONE_MASK | EU_SPATZ_START_MASK) // 0x800100 + //============================================================================= // IDMA Register Addresses //============================================================================= #define IDMA_CONF_OFFSET (0x00) -#define IDMA_STATUS_OFFSET (0x04) -#define IDMA_NEXT_ID_OFFSET (0x44) -#define IDMA_DONE_ID_OFFSET (0x84) +#define IDMA_STATUS_OFFSET (0x04) +#define IDMA_NEXT_ID_OFFSET (0x44) +#define IDMA_DONE_ID_OFFSET (0x84) #define IDMA_DST_ADDR_LOW_OFFSET (0xD0) #define IDMA_SRC_ADDR_LOW_OFFSET (0xD8) #define IDMA_LENGTH_LOW_OFFSET (0xE0) @@ -193,4 +200,4 @@ #define FSYNC_STATUS_BUSY_MASK (1 << 2) -#endif // _TILE_REG_DEFS_ \ No newline at end of file +#endif // _TILE_REG_DEFS_ diff --git a/targets/magia_v2/include/tile.h b/targets/magia_v2/include/tile.h index 55d511cf..6719eb6f 100644 --- a/targets/magia_v2/include/tile.h +++ b/targets/magia_v2/include/tile.h @@ -11,7 +11,6 @@ #include #include "regs/tile_ctrl.h" #include "addr_map/tile_addr_map.h" -//#include "utils/tinyprintf.h" #include "utils/printf.h" #include "utils/magia_tile_utils.h" #include "utils/magia_utils.h" @@ -22,5 +21,6 @@ #include "utils/performance_utils.h" //#include "utils/amo_utils.h" #include "utils/eu_isa_utils.h" +#include "utils/magia_spatz_utils.h" -#endif //_TILE_INCLUDE_GUARD_ \ No newline at end of file +#endif //_TILE_INCLUDE_GUARD_ diff --git a/targets/magia_v2/include/utils/amo_utils.h b/targets/magia_v2/include/utils/amo_utils.h index 543cde8a..58069368 100644 --- a/targets/magia_v2/include/utils/amo_utils.h +++ b/targets/magia_v2/include/utils/amo_utils.h @@ -15,7 +15,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Authors: Alberto Dequino - * + * * MAGIA Atomic Memory Operations Utils */ @@ -43,4 +43,4 @@ inline void amo_increment(volatile uint32_t addr){ asm volatile("amoadd.w t2, t1, (t0)" ::); } -#endif //AMO_UTILS_H \ No newline at end of file +#endif //AMO_UTILS_H diff --git a/targets/magia_v2/include/utils/fsync_isa_utils.h b/targets/magia_v2/include/utils/fsync_isa_utils.h index 3d72ab2a..5cc75444 100644 --- a/targets/magia_v2/include/utils/fsync_isa_utils.h +++ b/targets/magia_v2/include/utils/fsync_isa_utils.h @@ -16,15 +16,14 @@ * * Authors: Victor Isachi * Alberto Dequino - * + * * MAGIA FractalSync ISA Utils */ #ifndef FSYNC_ISA_UTILS_H #define FSYNC_ISA_UTILS_H -//#include "utils/tinyprintf.h" -#include "utils/printf.h" +#include "printf.h" #include "addr_map/tile_addr_map.h" #include "regs/tile_ctrl.h" #include "performance_utils.h" @@ -69,70 +68,70 @@ inline void fsync_legacy(volatile uint32_t level){ // (0x0 << 7) | \ /* Reserved - 0x0 */ // (0b1011011 << 0) \n"); /* OPCODE */ /** - * This ISA instruction is the bread and butter for synchronizing the current tile with an arbitrary subset of - * other tiles in the MAGIA mesh. The functionality of this instruction is NOT easy to understand or correctly - * utilize, it is heavily recomended to avoid directly using this instruction and instead use the API wrappers + * This ISA instruction is the bread and butter for synchronizing the current tile with an arbitrary subset of + * other tiles in the MAGIA mesh. The functionality of this instruction is NOT easy to understand or correctly + * utilize, it is heavily recomended to avoid directly using this instruction and instead use the API wrappers * hiding this behemoth. - * + * * But if you insist to use it for your little, special experiment, then be my fucking guest. - * + * * ID and AGGREGATE are the two values that guide the entire synchronization process. - * - * Starting from the tile this instruction is called, the fractal sync tree is explored in reverse order, towards + * + * Starting from the tile this instruction is called, the fractal sync tree is explored in reverse order, towards * the root node. - * + * * If ID is even (or zero), the HORIZONTAL tree is explored. If ID is odd, the VERTICAL tree is explored. - * - * The number of nodes traversed is equal to the number of significant bits passed in the AGGREGATE value. + * + * The number of nodes traversed is equal to the number of significant bits passed in the AGGREGATE value. * In fact, you should always pass AGGREGATE as a bit string to know what you are exactly doing. (I.E. 0b110) - * + * * The MSB is the highest level explored, the LSB is the lowest. - * - * If there is at least one tile you want to synchronize with, which visible from a certain level, you should put 1 in - * the bit associated for that level. Instead, if there are no tiles you have to synchronize with in a certain + * + * If there is at least one tile you want to synchronize with, which visible from a certain level, you should put 1 in + * the bit associated for that level. Instead, if there are no tiles you have to synchronize with in a certain * level THAT YOU HAVEN'T SYNCHRONIZED WITH IN A PREVIOUS ONE, then you put 0 in its associated bit. - * - * If you mess up and put 1 in a level in which there are no other tiles to synchronize with, - * or in which there are only tiles you already synchronized in a previous level, you are in Deadlock City baby. - * + * + * If you mess up and put 1 in a level in which there are no other tiles to synchronize with, + * or in which there are only tiles you already synchronized in a previous level, you are in Deadlock City baby. + * * Told you to use the fucking APIs! - * - * If the AGGREGATE value is EXACTLY 1, then a special behavior is activated. - * + * + * If the AGGREGATE value is EXACTLY 1, then a special behavior is activated. + * * Depending on the ID value, the current tile will synchronize with: - * + * * ID == 0 : The tile at synchronization level 0 in the horizontal fsync tree * ID == 1 : The tile at synchronization level 0 in the vertical fsync tree * ID == 2 : The tile horizontally neighboring NOT visible at synch level 0 in the horizontal fsync tree * ID == 3 : The tile vertically neighboring NOT visible at synch level 0 in the vertical fsync tree - * + * * If you have no fucking clue on what you just read means, then I'm sorry but you are not in the right place. * Try the MAGIA repository README file! - * + * * There is more! The ID value, in fact, isn't just used to decide whether we explore the horizontal or vertical * tree. In fact, through a single synchronization tree node there might be multiple fsync calls going through in - * parallel at the same time. - * - * To avoid collisions, multiple barriers are set up for each node, the one on which the instruction waits is + * parallel at the same time. + * + * To avoid collisions, multiple barriers are set up for each node, the one on which the instruction waits is * chosen by the ID value. - * + * * It's up to YOU to make sure that the tiles that are synchronizing are calling the fsync over the same barrier ID. - * + * * Unfortunately, you can't choose whichever ID you want. There is a physical ID limit equal to: - * + * * - For the horizontal fsync tree: 2 * ((2^L) - 1) * - For the vertical fsync tree: 2 * ((2^L) - 1) + 1 * - For the nodes that are in both fsync trees: ((2^L) - 1) - * - * Where L is the level of the MSB in the AGGREGATE value. This means that you must have a solid idea of the + * + * Where L is the level of the MSB in the AGGREGATE value. This means that you must have a solid idea of the * nature of the highest node you are synchronizing with. And of the fsync map, in general. If you mess up, you're screwed. - * + * * I'd gladly write down some examples, but my ASCII art skills are dogshit, so instead just open the APIs and * take a look on how it is possible to do stuff like synchronizing specific rows, columns, diagnolas, the outer * ring, and from there you should have a rough idea on how to do this. - * + * * Maybe. - * + * * Good luck! */ inline void fsync(volatile uint32_t id, volatile uint32_t aggregate){ @@ -168,6 +167,6 @@ inline void fsync(volatile uint32_t id, volatile uint32_t aggregate){ #endif #endif } - + #endif /*FSYNC_ISA_UTILS_H*/ diff --git a/targets/magia_v2/include/utils/io.h b/targets/magia_v2/include/utils/io.h index 11226b92..417826ea 100644 --- a/targets/magia_v2/include/utils/io.h +++ b/targets/magia_v2/include/utils/io.h @@ -17,7 +17,7 @@ * * Authors: * Alberto Dequino - * + * * IO */ #ifndef IO_H @@ -148,4 +148,4 @@ void *memcpy(void *dst0, const void *src0, size_t len0); void *memmove(void *d, const void *s, size_t n); -#endif // IO_H \ No newline at end of file +#endif // IO_H diff --git a/targets/magia_v2/include/utils/magia_spatz_utils.h b/targets/magia_v2/include/utils/magia_spatz_utils.h new file mode 100644 index 00000000..03638bd9 --- /dev/null +++ b/targets/magia_v2/include/utils/magia_spatz_utils.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 ETH Zurich and University of Bologna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 + * + * Authors: Luca Balboni + * + * Spatz Utility Functions + */ +#ifndef MAGIA_SPATZ_UTILS_H +#define MAGIA_SPATZ_UTILS_H + +#include +#include "magia_tile_utils.h" +#include "addr_map/tile_addr_map.h" + +#define SPATZ_CLK_EN (SPATZ_CTRL_BASE + 0x00) +#define SPATZ_READY (SPATZ_CTRL_BASE + 0x04) +#define SPATZ_START (SPATZ_CTRL_BASE + 0x08) +#define SPATZ_TASKBIN (SPATZ_CTRL_BASE + 0x0C) +#define SPATZ_DATA (SPATZ_CTRL_BASE + 0x10) +#define SPATZ_RETURN (SPATZ_CTRL_BASE + 0x14) +#define SPATZ_DONE (SPATZ_CTRL_BASE + 0x18) + +static inline void spatz_clk_en(void) { + mmio32(SPATZ_CLK_EN) = 1; +} + +static inline void spatz_clk_dis(void) { + mmio32(SPATZ_CLK_EN) = 0; +} + +static inline void spatz_set_func(uint32_t addr) { + mmio32(SPATZ_TASKBIN) = addr; +} + +static inline void spatz_trigger_en_irq(void) { + mmio32(SPATZ_START) = 1; +} + +static inline void spatz_trigger_dis_irq(void) { + mmio32(SPATZ_START) = 0; +} + +static inline void spatz_done(void) { + mmio32(SPATZ_DONE) = 1; +} + +static inline uint32_t spatz_get_exit_code(void) { + return mmio32(SPATZ_RETURN); +} + +static inline void spatz_run_task(uint32_t spatz_task_addr) { + spatz_set_func(spatz_task_addr); + spatz_trigger_en_irq(); + while(mmio32(SPATZ_START) != 0); +} + +static inline void spatz_pass_params(uint32_t params_ptr) { + mmio32(SPATZ_DATA) = params_ptr; +} + +static inline void spatz_run_task_with_params(uint32_t spatz_task_addr, uint32_t params_ptr) { + spatz_pass_params(params_ptr); + spatz_run_task(spatz_task_addr); +} + +static inline void spatz_init(uint32_t spatz_start_addr) { + spatz_set_func(spatz_start_addr); + spatz_clk_en(); + while (mmio32(SPATZ_READY) == 0){ + printf("[CV32] Waiting for Spatz to be ready...\n"); + }; +} + +#endif diff --git a/targets/magia_v2/include/utils/magia_tile_utils.h b/targets/magia_v2/include/utils/magia_tile_utils.h index 789371b6..a40c3672 100644 --- a/targets/magia_v2/include/utils/magia_tile_utils.h +++ b/targets/magia_v2/include/utils/magia_tile_utils.h @@ -16,14 +16,13 @@ * * Authors: Victor Isachi * Alberto Dequino - * + * * MAGIA Tile Utils */ #ifndef MAGIA_TILE_UTILS_H #define MAGIA_TILE_UTILS_H -//#include "tinyprintf.h" #include "printf.h" #define mmio64(x) (*(volatile uint64_t *)(x)) @@ -31,6 +30,10 @@ #define mmio16(x) (*(volatile uint16_t *)(x)) #define mmio8(x) (*(volatile uint8_t *)(x)) +#define mmio_fp64(x) (*(volatile float64 *)(x)) +#define mmio_fp32(x) (*(volatile float32 *)(x)) +#define mmio_fp16(x) (*(volatile float16 *)(x)) + #define addr64(x) (*(uint64_t *)(&x)) #define addr32(x) (*(uint32_t *)(&x)) #define addr16(x) (*(uint16_t *)(&x)) @@ -122,4 +125,4 @@ static uint32_t get_time(){ return timel; } -#endif /*MAGIA_TILE_UTILS_H*/ \ No newline at end of file +#endif /* MAGIA_TILE_UTILS_H */ diff --git a/targets/magia_v2/include/utils/magia_utils.h b/targets/magia_v2/include/utils/magia_utils.h index 2d7c69d7..fa6dfc1c 100644 --- a/targets/magia_v2/include/utils/magia_utils.h +++ b/targets/magia_v2/include/utils/magia_utils.h @@ -16,7 +16,7 @@ * * Authors: Victor Isachi * Alberto Dequino - * + * * MAGIA Utils */ @@ -57,8 +57,8 @@ inline uint32_t get_l1_base(uint32_t hartid){ static char* utoa(unsigned int value, unsigned int base, char* result) { if (base < 2 || base > 16){ - *result = '\0'; - return result; + *result = '\0'; + return result; } char *ptr0 = result; @@ -73,7 +73,7 @@ static char* utoa(unsigned int value, unsigned int base, char* result) { } while (value); *ptr0-- = '\0'; - + // Reverse the string while(ptr1 < ptr0) { tmp_char = *ptr0; @@ -144,4 +144,4 @@ static void magia_return(uint32_t hartid, uint32_t exit_code){ mmio16(TEST_END_ADDR + hartid*2) = (uint16_t) (exit_code - get_hartid()); } -#endif /*MAGIA_UTILS_H*/ \ No newline at end of file +#endif /* MAGIA_UTILS_H */ diff --git a/targets/magia_v2/include/utils/performance_utils.h b/targets/magia_v2/include/utils/performance_utils.h index cb00079c..8d1fc11b 100644 --- a/targets/magia_v2/include/utils/performance_utils.h +++ b/targets/magia_v2/include/utils/performance_utils.h @@ -16,7 +16,7 @@ * * Authors: Victor Isachi * Alberto Dequino - * + * * MAGIA Utils */ @@ -153,4 +153,4 @@ static inline void stnl_r(){ asm volatile("addi x0, x0, 0x5EE" ::); } -#endif \ No newline at end of file +#endif diff --git a/targets/magia_v2/include/utils/printf.h b/targets/magia_v2/include/utils/printf.h index eb140f06..805e828d 100644 --- a/targets/magia_v2/include/utils/printf.h +++ b/targets/magia_v2/include/utils/printf.h @@ -17,7 +17,7 @@ * * Authors: * Alberto Dequino - * + * * PRINTF */ #ifndef PRINTF_H @@ -41,4 +41,4 @@ static int printf(const char *format, ...) //#define printf tfp_printf -#endif // PRINTF_H \ No newline at end of file +#endif // PRINTF_H diff --git a/targets/magia_v2/include/utils/tinyprintf.h b/targets/magia_v2/include/utils/tinyprintf.h deleted file mode 100644 index cfc11750..00000000 --- a/targets/magia_v2/include/utils/tinyprintf.h +++ /dev/null @@ -1,709 +0,0 @@ -/* - -Copyright (c) 2004,2012 Kustaa Nyholm / SpareTimeLabs - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Kustaa Nyholm or SpareTimeLabs nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This modified tinyprintf is distributed under the conditions of the BSD-new license -as explicitly allowed: - -> https://github.com/cjlano/tinyprintf commit 2ee3012 - -They provide a simple and small (+400 loc) printf functionality to -be used in embedded systems. - -I've found them so useful in debugging that I do not bother with a -debugger at all. - -They are distributed in source form, so to use them, just compile them -into your project. - -Two printf variants are provided: printf and the 'sprintf' family of -functions ('snprintf', 'sprintf', 'vsnprintf', 'vsprintf'). - -The formats supported by this implementation are: -'c' 'd' 'i' 'o' 'p' 'u' 's' 'x' 'X'. - -Zero padding and field width are also supported. - -If the library is compiled with 'PRINTF_SUPPORT_LONG' defined, then -the long specifier is also supported. Note that this will pull in some -long math routines (pun intended!) and thus make your executable -noticeably longer. Likewise with 'PRINTF_LONG_LONG_SUPPORT' for the -long long specifier, and with 'PRINTF_SIZE_T_SUPPORT' for the size_t -specifier. - -The memory footprint of course depends on the target CPU, compiler and -compiler options, but a rough guesstimate (based on a H8S target) is about -1.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space. -Not too bad. Your mileage may vary. By hacking the source code you can -get rid of some hundred bytes, I'm sure, but personally I feel the balance of -functionality and flexibility versus code size is close to optimal for -many embedded systems. - -To use the printf, you need to supply your own character output function, -something like : - -void putc ( void* p, char c) -{ - while (!SERIAL_PORT_EMPTY) ; - SERIAL_PORT_TX_REGISTER = c; -} - -Before you can call printf, you need to initialize it to use your -character output function with something like: - -init_printf(NULL,putc); - -Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', -the NULL (or any pointer) you pass into the 'init_printf' will eventually be -passed to your 'putc' routine. This allows you to pass some storage space (or -anything really) to the character output function, if necessary. -This is not often needed but it was implemented like that because it made -implementing the sprintf function so neat (look at the source code). - -The code is re-entrant, except for the 'init_printf' function, so it is safe -to call it from interrupts too, although this may result in mixed output. -If you rely on re-entrancy, take care that your 'putc' function is re-entrant! - -The printf and sprintf functions are actually macros that translate to -'tfp_printf' and 'tfp_sprintf' when 'TINYPRINTF_OVERRIDE_LIBC' is set -(default). Setting it to 0 makes it possible to use them along with -'stdio.h' printf's in a single source file. When -'TINYPRINTF_OVERRIDE_LIBC' is set, please note that printf/sprintf are -not function-like macros, so if you have variables or struct members -with these names, things will explode in your face. Without variadic -macros this is the best we can do to wrap these function. If it is a -problem, just give up the macros and use the functions directly, or -rename them. - -It is also possible to avoid defining tfp_printf and/or tfp_sprintf by -clearing 'TINYPRINTF_DEFINE_TFP_PRINTF' and/or -'TINYPRINTF_DEFINE_TFP_SPRINTF' to 0. This allows for example to -export only tfp_format, which is at the core of all the other -functions. - -For further details see source code. - -regs Kusti, 23.10.2004 -*/ - -#include "addr_map/tile_addr_map.h" -#include - -#ifndef _TINYPRINTF_INCLUDE_GUARD_ -#define _TINYPRINTF_INCLUDE_GUARD_ - -static void putf(char *null, char c) { - *(volatile uint8_t *) (PRINT_ADDR) = (uint8_t)c; -} - -#ifndef __TFP_PRINTF__ -#define __TFP_PRINTF__ - -#include - -/* Global configuration */ - -/* Set this to 0 if you do not want to provide tfp_printf */ -#ifndef TINYPRINTF_DEFINE_TFP_PRINTF -# define TINYPRINTF_DEFINE_TFP_PRINTF 1 -#endif - -/* Set this to 0 if you do not want to provide - tfp_sprintf/snprintf/vsprintf/vsnprintf */ -#ifndef TINYPRINTF_DEFINE_TFP_SPRINTF -# define TINYPRINTF_DEFINE_TFP_SPRINTF 1 -#endif - -/* Set this to 0 if you do not want tfp_printf and - tfp_{vsn,sn,vs,s}printf to be also available as - printf/{vsn,sn,vs,s}printf */ -#ifndef TINYPRINTF_OVERRIDE_LIBC -# define TINYPRINTF_OVERRIDE_LIBC 1 -#endif - -/* Optional external types dependencies */ - -#if TINYPRINTF_DEFINE_TFP_SPRINTF -# include /* size_t */ -#endif - -/* Declarations */ - -#ifdef __GNUC__ -# define _TFP_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx) \ - __attribute__((format (printf, fmt_idx, arg1_idx))) -#else -# define _TFP_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*putcf) (void *, char); - -/* - 'tfp_format' really is the central function for all tinyprintf. For - each output character after formatting, the 'putf' callback is - called with 2 args: - - an arbitrary void* 'putp' param defined by the user and - passed unmodified from 'tfp_format', - - the character. - The 'tfp_printf' and 'tfp_sprintf' functions simply define their own - callback and pass to it the right 'putp' it is expecting. -*/ -static void tfp_format(void *putp, putcf putf, const char *fmt, va_list va); - -#if TINYPRINTF_DEFINE_TFP_SPRINTF -static int tfp_vsnprintf(char *str, size_t size, const char *fmt, va_list ap); -static int tfp_snprintf(char *str, size_t size, const char *fmt, ...) \ - _TFP_SPECIFY_PRINTF_FMT(3, 4); -static int tfp_vsprintf(char *str, const char *fmt, va_list ap); -static int tfp_sprintf(char *str, const char *fmt, ...) \ - _TFP_SPECIFY_PRINTF_FMT(2, 3); -# if TINYPRINTF_OVERRIDE_LIBC -# define vsnprintf tfp_vsnprintf -# define snprintf tfp_snprintf -# define vsprintf tfp_vsprintf -# define sprintf tfp_sprintf -# endif -#endif - -#if TINYPRINTF_DEFINE_TFP_PRINTF -static void init_printf(void *putp, putcf putf); -static void tfp_printf(char *fmt, ...) _TFP_SPECIFY_PRINTF_FMT(1, 2); -# if TINYPRINTF_OVERRIDE_LIBC -# define printf tfp_printf -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif - - - -/* - * Configuration - */ - -/* Enable long int support */ -// #define PRINTF_LONG_SUPPORT - -/* Enable long long int support (implies long int support) */ -// #define PRINTF_LONG_LONG_SUPPORT - -/* Enable %z (size_t) support */ -// #define PRINTF_SIZE_T_SUPPORT - -/* - * Configuration adjustments - */ -#ifdef PRINTF_SIZE_T_SUPPORT -#include -#endif - -#ifdef PRINTF_LONG_LONG_SUPPORT -# define PRINTF_LONG_SUPPORT -#endif - -/* __SIZEOF___ defined at least by gcc */ -#ifdef __SIZEOF_POINTER__ -# define SIZEOF_POINTER __SIZEOF_POINTER__ -#endif -#ifdef __SIZEOF_LONG_LONG__ -# define SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ -#endif -#ifdef __SIZEOF_LONG__ -# define SIZEOF_LONG __SIZEOF_LONG__ -#endif -#ifdef __SIZEOF_INT__ -# define SIZEOF_INT __SIZEOF_INT__ -#endif - -#ifdef __GNUC__ -# define _TFP_GCC_NO_INLINE_ __attribute__ ((noinline)) -#else -# define _TFP_GCC_NO_INLINE_ -#endif - -/* - * Implementation - */ -struct param { - char lz:1; /**< Leading zeros */ - char alt:1; /**< alternate form */ - char uc:1; /**< Upper case (for base16 only) */ - char align_left:1; /**< 0 == align right (default), 1 == align left */ - unsigned int width; /**< field width */ - char sign; /**< The sign to display (if any) */ - unsigned int base; /**< number base (e.g.: 8, 10, 16) */ - char *bf; /**< Buffer to output */ -}; - - -#ifdef PRINTF_LONG_LONG_SUPPORT -static void _TFP_GCC_NO_INLINE_ ulli2a( - unsigned long long int num, struct param *p) -{ - int n = 0; - unsigned long long int d = 1; - char *bf = p->bf; - while (num / d >= p->base) - d *= p->base; - while (d != 0) { - int dgt = num / d; - num %= d; - d /= p->base; - if (n || dgt > 0 || d == 0) { - *bf++ = dgt + (dgt < 10 ? '0' : (p->uc ? 'A' : 'a') - 10); - ++n; - } - } - *bf = 0; -} - -static void lli2a(long long int num, struct param *p) -{ - if (num < 0) { - num = -num; - p->sign = '-'; - } - ulli2a(num, p); -} -#endif - -#ifdef PRINTF_LONG_SUPPORT -static void uli2a(unsigned long int num, struct param *p) -{ - int n = 0; - unsigned long int d = 1; - char *bf = p->bf; - while (num / d >= p->base) - d *= p->base; - while (d != 0) { - int dgt = num / d; - num %= d; - d /= p->base; - if (n || dgt > 0 || d == 0) { - *bf++ = dgt + (dgt < 10 ? '0' : (p->uc ? 'A' : 'a') - 10); - ++n; - } - } - *bf = 0; -} - -static void li2a(long num, struct param *p) -{ - if (num < 0) { - num = -num; - p->sign = '-'; - } - uli2a(num, p); -} -#endif - -static void ui2a(unsigned int num, struct param *p) -{ - int n = 0; - unsigned int d = 1; - char *bf = p->bf; - while (num / d >= p->base) - d *= p->base; - while (d != 0) { - int dgt = num / d; - num %= d; - d /= p->base; - if (n || dgt > 0 || d == 0) { - *bf++ = dgt + (dgt < 10 ? '0' : (p->uc ? 'A' : 'a') - 10); - ++n; - } - } - *bf = 0; -} - -static void i2a(int num, struct param *p) -{ - if (num < 0) { - num = -num; - p->sign = '-'; - } - ui2a(num, p); -} - -static int a2d(char ch) -{ - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else - return -1; -} - -static char a2u(char ch, const char **src, int base, unsigned int *nump) -{ - const char *p = *src; - unsigned int num = 0; - int digit; - while ((digit = a2d(ch)) >= 0) { - if (digit > base) - break; - num = num * base + digit; - ch = *p++; - } - *src = p; - *nump = num; - return ch; -} - -static void putchw(void *putp, putcf putf__, struct param *p) -{ - char ch; - int n = p->width; - char *bf = p->bf; - - /* Number of filling characters */ - while (*bf++ && n > 0) - n--; - if (p->sign) - n--; - if (p->alt && p->base == 16) - n -= 2; - else if (p->alt && p->base == 8) - n--; - - /* Fill with space to align to the right, before alternate or sign */ - if (!p->lz && !p->align_left) { - while (n-- > 0) - putf(putp, ' '); - } - - /* print sign */ - if (p->sign) - putf(putp, p->sign); - - /* Alternate */ - if (p->alt && p->base == 16) { - putf(putp, '0'); - putf(putp, (p->uc ? 'X' : 'x')); - } else if (p->alt && p->base == 8) { - putf(putp, '0'); - } - - /* Fill with zeros, after alternate or sign */ - if (p->lz) { - while (n-- > 0) - putf(putp, '0'); - } - - /* Put actual buffer */ - bf = p->bf; - while ((ch = *bf++)) - putf(putp, ch); - - /* Fill with space to align to the left, after string */ - if (!p->lz && p->align_left) { - while (n-- > 0) - putf(putp, ' '); - } -} - -static void tfp_format(void *putp, putcf putf__, const char *fmt, va_list va) -{ - struct param p; -#ifdef PRINTF_LONG_SUPPORT - char bf[23]; /* long = 64b on some architectures */ -#else - char bf[12]; /* int = 32b on some architectures */ -#endif - char ch; - p.bf = bf; - - while ((ch = *(fmt++))) { - if (ch != '%') { - putf(putp, ch); - } else { -#ifdef PRINTF_LONG_SUPPORT - char lng = 0; /* 1 for long, 2 for long long */ -#endif - /* Init parameter struct */ - p.lz = 0; - p.alt = 0; - p.width = 0; - p.align_left = 0; - p.sign = 0; - - /* Flags */ - while ((ch = *(fmt++))) { - switch (ch) { - case '-': - p.align_left = 1; - continue; - case '0': - p.lz = 1; - continue; - case '#': - p.alt = 1; - continue; - default: - break; - } - break; - } - - /* Width */ - if (ch >= '0' && ch <= '9') { - ch = a2u(ch, &fmt, 10, &(p.width)); - } - - /* We accept 'x.y' format but don't support it completely: - * we ignore the 'y' digit => this ignores 0-fill - * size and makes it == width (ie. 'x') */ - if (ch == '.') { - p.lz = 1; /* zero-padding */ - /* ignore actual 0-fill size: */ - do { - ch = *(fmt++); - } while ((ch >= '0') && (ch <= '9')); - } - -#ifdef PRINTF_SIZE_T_SUPPORT -# ifdef PRINTF_LONG_SUPPORT - if (ch == 'z') { - ch = *(fmt++); - if (sizeof(size_t) == sizeof(unsigned long int)) - lng = 1; -# ifdef PRINTF_LONG_LONG_SUPPORT - else if (sizeof(size_t) == sizeof(unsigned long long int)) - lng = 2; -# endif - } else -# endif -#endif - -#ifdef PRINTF_LONG_SUPPORT - if (ch == 'l') { - ch = *(fmt++); - lng = 1; -#ifdef PRINTF_LONG_LONG_SUPPORT - if (ch == 'l') { - ch = *(fmt++); - lng = 2; - } -#endif - } -#endif - switch (ch) { - case 0: - goto abort; - case 'u': - p.base = 10; -#ifdef PRINTF_LONG_SUPPORT -#ifdef PRINTF_LONG_LONG_SUPPORT - if (2 == lng) - ulli2a(va_arg(va, unsigned long long int), &p); - else -#endif - if (1 == lng) - uli2a(va_arg(va, unsigned long int), &p); - else -#endif - ui2a(va_arg(va, unsigned int), &p); - putchw(putp, putf, &p); - break; - case 'd': - case 'i': - p.base = 10; -#ifdef PRINTF_LONG_SUPPORT -#ifdef PRINTF_LONG_LONG_SUPPORT - if (2 == lng) - lli2a(va_arg(va, long long int), &p); - else -#endif - if (1 == lng) - li2a(va_arg(va, long int), &p); - else -#endif - i2a(va_arg(va, int), &p); - putchw(putp, putf, &p); - break; -#ifdef SIZEOF_POINTER - case 'p': - p.alt = 1; -#ifdef PRINTF_LONG_SUPPORT -# if defined(SIZEOF_INT) && SIZEOF_POINTER <= SIZEOF_INT - lng = 0; -# elif defined(SIZEOF_LONG) && SIZEOF_POINTER <= SIZEOF_LONG - lng = 1; -# elif defined(SIZEOF_LONG_LONG) && SIZEOF_POINTER <= SIZEOF_LONG_LONG - lng = 2; -# endif -#endif -#endif - case 'x': - case 'X': - p.base = 16; - p.uc = (ch == 'X')?1:0; -#ifdef PRINTF_LONG_SUPPORT -#ifdef PRINTF_LONG_LONG_SUPPORT - if (2 == lng) - ulli2a(va_arg(va, unsigned long long int), &p); - else -#endif - if (1 == lng) - uli2a(va_arg(va, unsigned long int), &p); - else -#endif - ui2a(va_arg(va, unsigned int), &p); - putchw(putp, putf, &p); - break; - case 'o': - p.base = 8; - ui2a(va_arg(va, unsigned int), &p); - putchw(putp, putf, &p); - break; - case 'c': - putf(putp, (char)(va_arg(va, int))); - break; - case 's': - p.bf = va_arg(va, char *); - putchw(putp, putf, &p); - p.bf = bf; - break; - case '%': - putf(putp, ch); - default: - break; - } - } - } - abort:; -} - -#if TINYPRINTF_DEFINE_TFP_PRINTF -static putcf stdout_putf; -static void *stdout_putp; - -static void init_printf(void *putp, putcf putf__) -{ - stdout_putf = putf; - stdout_putp = putp; -} - -static void tfp_printf(char *fmt, ...) -{ - va_list va; - va_start(va, fmt); - tfp_format(stdout_putp, stdout_putf, fmt, va); - va_end(va); -} -#endif - -#if TINYPRINTF_DEFINE_TFP_SPRINTF -struct _vsnprintf_putcf_data -{ - size_t dest_capacity; - char *dest; - size_t num_chars; -}; - -static void _vsnprintf_putcf(void *p, char c) -{ - struct _vsnprintf_putcf_data *data = (struct _vsnprintf_putcf_data*)p; - if (data->num_chars < data->dest_capacity) - data->dest[data->num_chars] = c; - data->num_chars ++; -} - -static int tfp_vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ - struct _vsnprintf_putcf_data data; - - if (size < 1) - return 0; - - data.dest = str; - data.dest_capacity = size-1; - data.num_chars = 0; - tfp_format(&data, _vsnprintf_putcf, format, ap); - - if (data.num_chars < data.dest_capacity) - data.dest[data.num_chars] = '\0'; - else - data.dest[data.dest_capacity] = '\0'; - - return data.num_chars; -} - -static int tfp_snprintf(char *str, size_t size, const char *format, ...) -{ - va_list ap; - int retval; - - va_start(ap, format); - retval = tfp_vsnprintf(str, size, format, ap); - va_end(ap); - return retval; -} - -struct _vsprintf_putcf_data -{ - char *dest; - size_t num_chars; -}; - -static void _vsprintf_putcf(void *p, char c) -{ - struct _vsprintf_putcf_data *data = (struct _vsprintf_putcf_data*)p; - data->dest[data->num_chars++] = c; -} - -static int tfp_vsprintf(char *str, const char *format, va_list ap) -{ - struct _vsprintf_putcf_data data; - data.dest = str; - data.num_chars = 0; - tfp_format(&data, _vsprintf_putcf, format, ap); - data.dest[data.num_chars] = '\0'; - return data.num_chars; -} - -static int tfp_sprintf(char *str, const char *format, ...) -{ - va_list ap; - int retval; - - va_start(ap, format); - retval = tfp_vsprintf(str, format, ap); - va_end(ap); - return retval; -} -#endif - -#endif \ No newline at end of file diff --git a/targets/magia_v2/link.ld b/targets/magia_v2/link.ld index 80d235ba..b844e801 100644 --- a/targets/magia_v2/link.ld +++ b/targets/magia_v2/link.ld @@ -21,8 +21,8 @@ __DYNAMIC = 0; MEMORY { instrram : ORIGIN = 0xcc000000, LENGTH = 0x8000 - dataram : ORIGIN = 0xcc100000, LENGTH = 0xF00000 - stack : ORIGIN = 0x00010000, LENGTH = 0x10000 /* 64K, maybe it's a bit too much (?) */ + dataram : ORIGIN = 0xcc010000, LENGTH = 0xF00000 /* TODOs: restore ORIGIN addr to 0xcc100000 when RTL will be aligned */ + stack : ORIGIN = 0x00010000, LENGTH = 0xC000 } /* Stack information variables */ @@ -61,6 +61,19 @@ SECTIONS _endtext = .; } > instrram + /* Spatz embedded binary - inlined from header file */ + /* Positioned right after CV32 .text in instrram */ + + . = ALIGN(4); + _spatz_binary_start = .; + + .spatz_binary : { + KEEP(*(.spatz_binary)) + } > instrram + + _spatz_binary_end = .; + _spatz_binary_size = _spatz_binary_end - _spatz_binary_start; + /*--------------------------------------------------------------------*/ /* Global constructor/destructor segment */ /*--------------------------------------------------------------------*/ @@ -131,4 +144,4 @@ SECTIONS _stack = . ; } > stack -} \ No newline at end of file +} diff --git a/targets/magia_v2/spatz/bootrom/spatz_init.S b/targets/magia_v2/spatz/bootrom/spatz_init.S new file mode 100644 index 00000000..9b7b11c9 --- /dev/null +++ b/targets/magia_v2/spatz/bootrom/spatz_init.S @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2018-2019 ETH Zurich and University of Bologna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 + * + * + * Authors: Luca Balboni + * + * All initialization (stack, regs, vector, BSS) done in spatz_crt0.S + * Minimal Boot ROM - only read TASKBIN_ADDR and jump + */ + +#define TASKBIN_ADDR 0x0000170C // OBI slave ctrl exchange register + + .section .text.bootrom + .global _start + .option norvc + +_start: + // Read dispatcher loop address from TASKBIN_ADDR (set by CV32) + li t0, TASKBIN_ADDR + lw t1, 0(t0) + + // Jump to _start in spatz binary (does all init) + jr t1 diff --git a/targets/magia_v2/spatz/bootrom/spatz_init.ld b/targets/magia_v2/spatz/bootrom/spatz_init.ld new file mode 100644 index 00000000..0ecdffc6 --- /dev/null +++ b/targets/magia_v2/spatz/bootrom/spatz_init.ld @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 ETH Zurich and University of Bologna + * + * Licensed under the Solderpad Hardware License, Version 0.51 + * (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * SPDX-License-Identifier: SHL-0.51 +/* + * Spatz Boot ROM Linker Script for MAGIA Tile + * + * Maps bootrom to 0x10000000 (outside L2 range to avoid AXI address decode overlap). + * The bootrom is synthesized as a hardware module (spatz_bootrom.sv) mapped via AXI slave. + * + * Boot sequence: + * 1. Spatz resets with PC = 0x10000000 (SPATZ_BOOT_ADDR in magia_tile.sv) + * 2. Bootrom initializes core (clear regs, setup interrupts) + * 3. Bootrom waits for MEIP interrupt via WFI + * 4. CV32 writes entry point to FUNC_PTR (0x1704) + * 5. CV32 triggers START_TRIGGER (0x1700) → MEIP interrupt + * 6. Bootrom reads FUNC_PTR and jumps to user program + */ + +SEARCH_DIR(.) +OUTPUT_ARCH(riscv) +ENTRY(_start) + +MEMORY +{ + bootrom : ORIGIN = 0x10000000, LENGTH = 0x100 /* 256B at 0x10000000 (outside L2 range to avoid AXI overlap) */ +} + +SECTIONS +{ + .text.bootrom : { + KEEP(*(.text.bootrom)) + *(.text) + *(.text.*) + } > bootrom + + .rodata : { + *(.rodata) + *(.rodata.*) + } > bootrom + + /* Discard all other sections */ + /DISCARD/ : { + *(.data) + *(.data.*) + *(.bss) + *(.bss.*) + *(.comment) + *(.note.*) + } +} diff --git a/targets/magia_v2/spatz/src/spatz_crt0.S b/targets/magia_v2/spatz/src/spatz_crt0.S new file mode 100644 index 00000000..72bf2896 --- /dev/null +++ b/targets/magia_v2/spatz/src/spatz_crt0.S @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2018-2019 ETH Zurich and University of Bologna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 + * + * Authors: Luca Balboni + * + * Spatz Runtime + * Entry: Bootrom should jumps here + * + */ + +#define READY_ADDR 0x00001704 +#define START_ADDR 0x00001708 +#define TASKBIN_ADDR 0x0000170C +#define DATA_ADDR 0x00001710 +#define RETURN_ADDR 0x00001714 +#define DONE_ADDR 0x00001718 +#define MSTATUS_VS 0x200 // Vector Status [9:8] = 01 +#define MSTATUS_MIE 0x8 // Machine Interrupt Enable +#define MIE_MEIE 0x800 // External interrupt enable + +.section .text.start, "ax" +.global _start + +_start: + /* Init stack pointer */ + li sp, 0x0001FFF8 + + /* Clear ALL integer registers */ + mv x1, x0 + // x2 = sp just initialized + mv x3, x0 + mv x4, x0 + mv x5, x0 + mv x6, x0 + mv x7, x0 + mv x8, x0 + mv x9, x0 + mv x10, x0 + mv x11, x0 + mv x12, x0 + mv x13, x0 + mv x14, x0 + mv x15, x0 + mv x16, x0 + mv x17, x0 + mv x18, x0 + mv x19, x0 + mv x20, x0 + mv x21, x0 + mv x22, x0 + mv x23, x0 + mv x24, x0 + mv x25, x0 + mv x26, x0 + mv x27, x0 + mv x28, x0 + mv x29, x0 + mv x30, x0 + mv x31, x0 + + /* Enable vector extension (VS=Initial for Spatz) */ + li t0, MSTATUS_VS + csrs mstatus, t0 + + /* Clear BSS section */ + la a0, __bss_start + la a1, __bss_end +1: bgeu a0, a1, 2f + sw zero, 0(a0) + addi a0, a0, 4 + j 1b +2: + /* Setup trap handler for interrupt */ + la t0, _trap_handler + csrw mtvec, t0 + + /* Enable external interrupts (MEIE) */ + li t0, MIE_MEIE + csrs mie, t0 + + /* Enable global interrupts (MIE bit in mstatus) */ + li t0, MSTATUS_MIE + csrs mstatus, t0 + + /* Signal ready to CV32 - now ready to receive interrupts */ + li t0, READY_ADDR + li t1, 1 + sw t1, 0(t0) + + /* First WFI - after this we deassert READY */ + wfi + + /* Deassert READY after first wakeup (only once) */ + li t0, READY_ADDR + sw zero, 0(t0) + + /* Fall through to main dispatcher loop */ + +dispatcher_loop: + /* Wait for interrupt from CV32 */ + wfi + + /* After wakeup from interrupt, task has been executed */ + /* Loop back */ + j dispatcher_loop + +/* Trap handler - distinguishes interrupts from exceptions */ +_trap_handler: + csrr t0, mcause + bltz t0, _handle_interrupt // mcause[31]=1 → interrupt + + /* EXCEPTION: Write error code to RETURN_ADDR, signal DONE, halt */ +_handle_exception: + csrr t1, mcause // Read full mcause + andi t1, t1, 0xFF // Extract exception code [7:0] + ori t1, t1, 0x100 // Set bit 8 to distinguish from task errors + li t0, RETURN_ADDR + sw t1, 0(t0) + + li t0, DONE_ADDR + li t1, 1 + sw t1, 0(t0) + + /* Halt */ +1: wfi + j 1b + +_handle_interrupt: + /* Check if external interrupt */ + andi t0, t0, 0x7FF + li t1, 11 + bne t0, t1, _trap_ret + + /* Read task address from TASKBIN_ADDR and save it in t1 */ + li t0, TASKBIN_ADDR + lw t1, 0(t0) + beqz t1, _trap_ret + + /* Clear START */ + li t0, START_ADDR + sw zero, 0(t0) + + /* Jump to saved task address */ + jalr ra, 0(t1) + + /* Task completed - write exit code 0 (success, no exceptions) */ + li t0, RETURN_ADDR + sw zero, 0(t0) + + /* Signal done */ + li t0, DONE_ADDR + li t1, 1 + sw t1, 0(t0) + +_trap_ret: + mret diff --git a/targets/magia_v2/spatz/src/spatz_program.ld b/targets/magia_v2/spatz/src/spatz_program.ld new file mode 100644 index 00000000..765a5344 --- /dev/null +++ b/targets/magia_v2/spatz/src/spatz_program.ld @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2018-2019 ETH Zurich and University of Bologna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 + * + * Memory Layout (when embedded in CV32 instrram): + * 0xCC000000: CV32 .text + * 0xCC000000 + CV32_size: .spatz_binary (Spatz code inline) + * + * Stack: Spatz uses remaining 16KB after CV32 (0x0001C000-0x00020000) + * - CV32 uses: 0x00010000-0x0001C000 (48KB) + * - Spatz uses: 0x0001C000-0x00020000 (16KB) + */ + +OUTPUT_ARCH(riscv) +ENTRY(_start) + +MEMORY +{ + prog (rwxa) : ORIGIN = 0x00000000, LENGTH = 0x10000 /* 64KB max - relative addressing */ +} + +/* Stack configuration - Spatz uses remaining 16KB after CV32 */ +/* CV32 uses: 0x00010000-0x0001C000 (48KB, from CV32 link.ld) */ +/* Spatz uses: 0x0001C000-0x00020000 (16KB) */ +_stack_start = 0x0001FFF8; /* Top of Spatz stack (grows downward) */ + +SECTIONS +{ + .text : { + . = ALIGN(4); + KEEP(*(.text.start)) + *(.text) + *(.text.*) + . = ALIGN(4); + } > prog + + .rodata : { + . = ALIGN(4); + *(.rodata) + *(.rodata.*) + . = ALIGN(4); + } > prog + + .data : { + . = ALIGN(4); + *(.data) + *(.data.*) + *(.sdata) + *(.sdata.*) + . = ALIGN(4); + } > prog + + .bss : { + . = ALIGN(4); + __bss_start = .; + *(.bss) + *(.bss.*) + *(.sbss) + *(.sbss.*) + *(COMMON) + . = ALIGN(4); + __bss_end = .; + } > prog + + /* Stack symbol for spatz_crt0.S */ + /* spatz_crt0.S uses: la sp, stack */ + stack = _stack_start; + + /* Discard debug sections */ + /DISCARD/ : { + *(.comment) + *(.note.*) + } +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 86db9c4a..a60400d3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,10 +7,17 @@ # Alberto Dequino # Define mappings for tests -set(TEST_MAPPINGS - magia_v1:magia - magia_v2:magia -) +if(SPATZ_TESTS) + set(TEST_MAPPINGS + magia_v1:magia + magia_v2:magia,spatz_on_magia + ) +else() + set(TEST_MAPPINGS + magia_v1:magia + magia_v2:magia + ) +endif() # Call the macro -add_magia_subdirectories(${TARGET_PLATFORM} "Test" "${TEST_MAPPINGS}") \ No newline at end of file +add_magia_subdirectories(${TARGET_PLATFORM} "Test" "${TEST_MAPPINGS}") diff --git a/tests/common/compare_utils.h b/tests/common/compare_utils.h new file mode 100644 index 00000000..9ab44cbc --- /dev/null +++ b/tests/common/compare_utils.h @@ -0,0 +1,95 @@ +#ifndef COMPARE_UTILS_H_ +#define COMPARE_UTILS_H_ + +#include +#include + +#include "tile.h" + +/** + * One ULP is the difference between two consecutive FP16 numbers + * A tollerance of 8 ULP means that two values can differ by a maximum + * of 8 consecutive representable FP16 values. + */ +#define ULP_TOLL (8) + +/** + * @brief Check if a FP16 value is NaN or (+/-)Inf + * + * @param [in] x FP16 value represented as uint16_t + * + * In IEEE754 half precision: + * - exponent = 11111 (0x7C00) indicates special values + * - mantissa = 0 -> Inf + * - mantissa != 0 -> NaN + * + * @return true if NaN or Inf, false otherwise + */ +static inline bool fp16_is_invalid(uint16_t x) +{ + return (x & 0x7C00) == 0x7C00; +} + +/** + * @brief Convert a FP16 raw value into ordered I32 + * + * @param [in] uint16_t x FP16 value casted to uitn16_t + * + * If negative, remove sign (i % 0x7FFF) and invert order (0x8000 - ) + * If positive, move the value to the "upper" part of I32 range (i + 0x8000) + * + * @return int32_t {description} + */ +static inline int32_t fp16_to_ordered(uint16_t x) +{ + int32_t i = (int32_t) x; + return (i & 0x8000) ? (0x8000 - (i & 0x7FFF)) : (i + 0x8000); +} + +/** + * @brief Compare two FP16 vectors using Units in the Last Place tollerance + * + * @param [in] uintptr_t addr_res result vector start address + * @param [in] uintptr_t addr_exp expected vector start address + * @param [in] int len number of elements of the two vectors + * + * @return true if match, false otherwise + */ +static inline bool vector_compare_fp16_bitwise(uintptr_t addr_res, uintptr_t addr_exp, int len) { + uint16_t expected; + uint16_t result; + int32_t ord_exp; + int32_t ord_res; + uint32_t offset; + int32_t diff; + bool ret; + + ret = true; + for (int i = 0; i < len; i++) { + offset = i * sizeof (uint16_t); + + expected = mmio16(addr_exp + offset); + result = mmio16(addr_res + offset); + + /* Reject NaN or Inf */ + if (fp16_is_invalid(expected) || fp16_is_invalid(result)) { + printf("Invalid FP16 value at idx %d\t-\texpected: %x\t-\tcomputed: %x\n", i, expected, result); + ret = false; + continue; + } + + ord_exp = fp16_to_ordered(expected); + ord_res = fp16_to_ordered(result); + + diff = (ord_exp > ord_res) ? (ord_exp - ord_res) : (ord_res - ord_exp); + + if (diff > ULP_TOLL) { + printf("Mismatch at index %d\t-\texpected: %x\t-\tcomputed: %x\n", i, expected, result); + ret = false; + } + } + + return ret; +} + +#endif /* COMPARE_UTILS_H_ */ diff --git a/tests/magia/mesh/CMakeLists.txt b/tests/magia/mesh/CMakeLists.txt index a79569cd..33961bc1 100644 --- a/tests/magia/mesh/CMakeLists.txt +++ b/tests/magia/mesh/CMakeLists.txt @@ -27,4 +27,4 @@ if (TARGET_PLATFORM STREQUAL "magia_v1") add_subdirectory(amo_lock_global) add_subdirectory(amo_lock_row) add_subdirectory(amo_lock_column) -endif() \ No newline at end of file +endif() diff --git a/tests/spatz_on_magia/CMakeLists.txt b/tests/spatz_on_magia/CMakeLists.txt new file mode 100644 index 00000000..432ff162 --- /dev/null +++ b/tests/spatz_on_magia/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(hello_spatz) + +add_subdirectory(onnx_add) +add_subdirectory(onnx_clip) +add_subdirectory(onnx_div) diff --git a/tests/spatz_on_magia/hello_spatz/CMakeLists.txt b/tests/spatz_on_magia/hello_spatz/CMakeLists.txt new file mode 100644 index 00000000..1adb6936 --- /dev/null +++ b/tests/spatz_on_magia/hello_spatz/CMakeLists.txt @@ -0,0 +1,14 @@ +set(TEST_NAME hello_spatz) + +# Compile Spatz task +add_spatz_task( + TEST_NAME ${TEST_NAME} + TASK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spatz_task/hello_task.c + FIRST_TASK_NAME hello_task +) + +# Compile CV32 executable with embedded Spatz binary +add_cv32_executable_with_spatz( + TARGET_NAME ${TEST_NAME} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.c +) diff --git a/tests/spatz_on_magia/hello_spatz/main.c b/tests/spatz_on_magia/hello_spatz/main.c new file mode 100644 index 00000000..4243d696 --- /dev/null +++ b/tests/spatz_on_magia/hello_spatz/main.c @@ -0,0 +1,43 @@ +#include "tile.h" +#include "eventunit.h" + +#include "hello_spatz_task_bin.h" + +int main(void) { + int errors; + eu_config_t eu_cfg; + eu_controller_t eu_ctrl; + + printf("[CV32] Hello Spatz Test\n"); + + errors = 0; + eu_cfg.hartid = get_hartid(); + eu_ctrl.base = NULL, + eu_ctrl.cfg = &eu_cfg, + eu_ctrl.api = &eu_api, + + printf("[CV32] Initializing Event Unit\n"); + eu_init(&eu_ctrl); + + printf("[CV32] Initializing Spatz Event Unit\n"); + eu_spatz_init(&eu_ctrl, 0); + + printf("[CV32] Initializing Spatz\n"); + spatz_init(SPATZ_BINARY_START); + + printf("[CV32] Launching SPATZ Task\n"); + spatz_run_task(HELLO_TASK); + + eu_spatz_wait(&eu_ctrl, WFE); + + if(spatz_get_exit_code() != 0) { + printf("[CV32] SPATZ TASK ENDED with exit code: 0x%03x\n", spatz_get_exit_code()); + errors++; + } else { + printf("[CV32] SPATZ TASK ENDED successfully\n"); + } + + spatz_clk_dis(); + + return errors; +} diff --git a/tests/spatz_on_magia/hello_spatz/spatz_task/hello_task.c b/tests/spatz_on_magia/hello_spatz/spatz_task/hello_task.c new file mode 100644 index 00000000..0c731f76 --- /dev/null +++ b/tests/spatz_on_magia/hello_spatz/spatz_task/hello_task.c @@ -0,0 +1,6 @@ +#include "printf.h" + +int hello_task(void) { + printf("[SNITCH] Hello World from Spatz!\n"); + return 0; +} diff --git a/tests/spatz_on_magia/onnx_add/CMakeLists.txt b/tests/spatz_on_magia/onnx_add/CMakeLists.txt new file mode 100644 index 00000000..8ae16823 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/CMakeLists.txt @@ -0,0 +1,20 @@ +set(TEST_NAME onnx_add) + +# Compile Spatz task +add_spatz_task( + TEST_NAME ${TEST_NAME} + TASK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spatz_task/onnx_add_task.c + FIRST_TASK_NAME onnx_add_task + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# Compile CV32 executable with embedded Spatz binary +add_cv32_executable_with_spatz( + TARGET_NAME ${TEST_NAME} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.c + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) diff --git a/tests/spatz_on_magia/onnx_add/include/onnx_add_mem_layout.h b/tests/spatz_on_magia/onnx_add/include/onnx_add_mem_layout.h new file mode 100644 index 00000000..a0078470 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/include/onnx_add_mem_layout.h @@ -0,0 +1,31 @@ +#ifndef ONNX_ADD_H_ +#define ONNX_ADD_H_ + +#include "data.h" +#include "magia_tile_utils.h" +#include "magia_utils.h" +#include "onnx_add_params.h" + +#define ALIGNMENT 4 +/* Aligns the given address to 4-byte */ +#define ALIGN_4B(addr) (((addr) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)) + +#define L1_BASE_TILE (L1_BASE + (get_hartid() * L1_TILE_OFFSET)) +#define VEC_SIZE (LEN * sizeof(float16)) + +#define ONNX_ADD_PARAMS_BASE L1_BASE_TILE +#define ONNX_ADD_PARAMS_SIZE ALIGN_4B(sizeof(onnx_add_params_t)) + +#define SRC_A_BASE ALIGN_4B(ONNX_ADD_PARAMS_BASE + ONNX_ADD_PARAMS_SIZE) +#define SRC_A_SIZE ALIGN_4B(VEC_SIZE) + +#define SRC_B_BASE ALIGN_4B(SRC_A_BASE + SRC_A_SIZE) +#define SRC_B_SIZE ALIGN_4B(VEC_SIZE) + +#define RES_BASE ALIGN_4B(SRC_B_BASE + SRC_B_SIZE) +#define RES_SIZE ALIGN_4B(VEC_SIZE) + +#define EXP_BASE ALIGN_4B(RES_BASE + RES_SIZE) +#define EXP_SIZE ALIGN_4B(VEC_SIZE) + +#endif /* ONNX_ADD_H_ */ diff --git a/tests/spatz_on_magia/onnx_add/include/onnx_add_params.h b/tests/spatz_on_magia/onnx_add/include/onnx_add_params.h new file mode 100644 index 00000000..092011d9 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/include/onnx_add_params.h @@ -0,0 +1,14 @@ +#ifndef ONNX_ADD_PARAMS_H_ +#define ONNX_ADD_PARAMS_H_ + +#include + +typedef struct { + uintptr_t addr_res; + uintptr_t addr_exp; + uintptr_t addr_a; + uintptr_t addr_b; + uint32_t len; +} onnx_add_params_t; + +#endif /* ONNX_ADD_PARAMS_H_ */ diff --git a/tests/spatz_on_magia/onnx_add/main.c b/tests/spatz_on_magia/onnx_add/main.c new file mode 100644 index 00000000..a7b65ea8 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/main.c @@ -0,0 +1,110 @@ +#include "tile.h" +#include "eventunit.h" + +#include "compare_utils.h" +#include "data.h" +#include "onnx_add_mem_layout.h" +#include "onnx_add_params.h" +#include "onnx_add_task_bin.h" + +static int init_data(void *params) +{ + uint32_t offset; + volatile onnx_add_params_t *add_params; + + add_params = (volatile onnx_add_params_t *) params; + for (int i = 0; i < LEN; i++) { + offset = i * sizeof(float16); + + mmio_fp16(EXP_BASE + offset) = expected[i]; + mmio_fp16(SRC_A_BASE + offset) = vec_a[i]; + mmio_fp16(SRC_B_BASE + offset) = vec_b[i]; + mmio_fp16(RES_BASE + offset) = 0; + } + + + add_params->addr_a = SRC_A_BASE; + add_params->addr_b = SRC_B_BASE; + add_params->addr_res = RES_BASE; + add_params->addr_exp = EXP_BASE; + add_params->len = LEN; + + return 0; +} + +static int run_spatz_task() +{ + int ret; + eu_config_t eu_cfg; + eu_controller_t eu_ctrl; + + eu_cfg.hartid = get_hartid(); + eu_ctrl.base = NULL, + eu_ctrl.cfg = &eu_cfg, + eu_ctrl.api = &eu_api, + + eu_init(&eu_ctrl); + eu_spatz_init(&eu_ctrl, 0); + + spatz_init(SPATZ_BINARY_START); + spatz_run_task_with_params(ONNX_ADD_TASK, ONNX_ADD_PARAMS_BASE); + + eu_spatz_wait(&eu_ctrl, WFE); + + ret = spatz_get_exit_code(); + + spatz_clk_dis(); + + return ret; +} + +static bool check_result(void *params) +{ + volatile onnx_add_params_t *add_params; + add_params = (volatile onnx_add_params_t *) params; + return vector_compare_fp16_bitwise(add_params->addr_res, add_params->addr_exp, add_params->len); +} + +static bool run_test() +{ + int ret; + bool check; + volatile onnx_add_params_t *params; + + params = (volatile onnx_add_params_t *) ONNX_ADD_PARAMS_BASE; + + ret = init_data(params); + if (ret != 0) { + printf("[CV32] Params initialization failed with error: %d\n", ret); + return ret; + } + + ret = run_spatz_task(); + if (ret != 0) { + printf("[CV32] Spatz task FAILED with error: %d", ret); + return ret; + } + + check = check_result(params); + if (check) { + printf("[CV32] Test SUCCESS\n"); + } else { + printf("[CV32] Test FAILED\n"); + ret = -1; + } + + return ret; +} + +int main(void) +{ + int ret; + + printf("\n##################################### ONNX_ADD TEST #####################################\n\n"); + + ret = run_test(); + + printf("\n##########################################################################################\n\n"); + + return ret; +} diff --git a/tests/spatz_on_magia/onnx_add/spatz_task/onnx_add_task.c b/tests/spatz_on_magia/onnx_add/spatz_task/onnx_add_task.c new file mode 100644 index 00000000..b1ba50a9 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/spatz_task/onnx_add_task.c @@ -0,0 +1,38 @@ +#include "tile.h" +#include "onnx_add_params.h" + +int onnx_add_task(void) +{ + volatile onnx_add_params_t *params; + uintptr_t params_addr; + _Float16 *a; + _Float16 *b; + _Float16 *r; + size_t avl; + size_t vl; + + params_addr = mmio32(SPATZ_DATA); + params = (volatile onnx_add_params_t *) params_addr; + + r = (_Float16 *)params->addr_res; + a = (_Float16 *)params->addr_a; + b = (_Float16 *)params->addr_b; + avl = params->len; + + for (; avl > 0; avl -= vl) { + asm volatile ("vsetvli %0, %1, e16, m8, ta, ma" : "=r"(vl) : "r"(avl)); + + asm volatile ("vle16.v v0, (%0)" :: "r"(a)); + asm volatile ("vle16.v v8, (%0)" :: "r"(b)); + + asm volatile ("vfadd.vv v16, v0, v8"); + + asm volatile ("vse16.v v16, (%0)" :: "r"(r)); + + a += vl; + b += vl; + r += vl; + } + + return 0; +} diff --git a/tests/spatz_on_magia/onnx_add/test_data/data.h b/tests/spatz_on_magia/onnx_add/test_data/data.h new file mode 100644 index 00000000..4a594b54 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/test_data/data.h @@ -0,0 +1,11 @@ +/* Automatically generated header file for Spatz ONNX testing */ +#ifndef DATA_H_ +#define DATA_H_ + +#define LEN 2048 + +static const float16 vec_a[] = { 6.394531f, -1.380859f, 0.033051f, 6.406250f, -13.734375f, 9.859375f, 6.269531f, 7.445312f, -11.257812f, 18.562500f, 7.257812f, -4.527344f, 0.936523f, -1.662109f, -1.446289f, 4.531250f, -2.275391f, 3.376953f, -13.914062f, -0.663086f, -3.861328f, -0.914551f, 1.480469f, -9.226562f, 16.859375f, -18.625000f, 7.875000f, -6.867188f, 11.375000f, -5.449219f, 13.148438f, 1.892578f, -5.996094f, 6.878906f, 4.578125f, 5.500000f, 5.921875f, -24.296875f, -17.000000f, -6.375000f, -5.367188f, -16.406250f, 0.163818f, 5.195312f, 2.908203f, -15.929688f, 11.640625f, 12.617188f, -0.734863f, 12.078125f, -1.381836f, 14.695312f, -8.765625f, -7.078125f, 14.437500f, 0.951172f, -24.359375f, 2.542969f, 7.730469f, -7.125000f, 1.527344f, 4.257812f, -7.984375f, 11.843750f, -11.531250f, -2.050781f, -3.617188f, 9.820312f, -5.773438f, -3.136719f, 9.703125f, 0.753906f, -0.846191f, 9.257812f, 10.921875f, 3.275391f, 14.460938f, -4.425781f, 8.648438f, 1.785156f, 8.945312f, 11.296875f, -0.432129f, 3.031250f, -4.062500f, 14.265625f, -8.648438f, 6.136719f, -0.057861f, -2.785156f, -8.843750f, -22.625000f, -18.546875f, 7.558594f, 24.515625f, 8.046875f, -15.273438f, -4.609375f, -11.929688f, -4.585938f, -17.718750f, 6.757812f, 8.109375f, 7.593750f, 4.945312f, -13.171875f, 23.484375f, -4.628906f, -3.496094f, -23.265625f, -8.242188f, -2.242188f, -14.757812f, 8.468750f, 4.976562f, -2.187500f, 5.890625f, -24.750000f, -3.460938f, 8.382812f, 16.031250f, -3.583984f, 1.125977f, 2.902344f, -1.394531f, 0.295410f, -5.324219f, 7.328125f, -8.937500f, 1.570312f, -14.445312f, -2.130859f, 5.960938f, -8.726562f, 15.031250f, -7.308594f, 4.679688f, 0.029556f, -16.000000f, -29.734375f, -1.335938f, -1.697266f, -4.148438f, 1.502930f, 1.097656f, -9.929688f, -4.750000f, -2.652344f, -1.518555f, 13.765625f, 0.490234f, -5.878906f, -10.507812f, -11.398438f, -8.140625f, 1.309570f, 0.595703f, 25.515625f, 9.187500f, -11.015625f, -15.210938f, -25.515625f, -15.742188f, 12.257812f, 13.367188f, -4.281250f, 18.375000f, 17.375000f, 2.736328f, 8.085938f, 6.707031f, 15.562500f, 10.609375f, -14.460938f, 0.987793f, -9.984375f, -11.000000f, -8.140625f, -7.804688f, -11.921875f, -12.585938f, 9.250000f, -9.875000f, -0.028061f, 23.531250f, -3.578125f, 9.875000f, 13.953125f, 15.585938f, 6.433594f, -8.195312f, 5.917969f, -0.217163f, -7.500000f, -11.718750f, 7.773438f, 11.515625f, -4.343750f, 13.570312f, -8.843750f, -6.562500f, -3.488281f, -20.640625f, 1.390625f, -2.710938f, -4.328125f, -10.000000f, 1.071289f, -12.007812f, -8.890625f, 9.500000f, -7.375000f, 1.040039f, -9.742188f, 0.516602f, 0.096619f, -6.171875f, 15.703125f, 0.775391f, 10.117188f, 0.175293f, 5.542969f, -4.992188f, -13.257812f, 23.062500f, 8.054688f, 3.244141f, -25.750000f, 6.468750f, 8.054688f, -9.054688f, 2.337891f, 8.648438f, 10.710938f, -3.425781f, -16.859375f, -1.219727f, 16.328125f, 7.042969f, 1.797852f, 2.546875f, -0.456299f, 7.406250f, -3.384766f, 4.929688f, -11.273438f, 30.578125f, 26.562500f, -8.460938f, -0.989746f, 9.937500f, -2.742188f, 8.109375f, -6.148438f, 5.015625f, 15.398438f, 21.984375f, -4.066406f, 10.515625f, 3.638672f, -5.902344f, 0.983887f, 5.746094f, -16.875000f, 1.205078f, -15.890625f, 6.644531f, -9.671875f, -13.382812f, 1.511719f, 9.593750f, 5.195312f, 4.960938f, 3.986328f, 3.005859f, -5.707031f, 11.023438f, 0.510742f, 6.960938f, 2.017578f, 3.750000f, -0.679688f, 4.570312f, 9.187500f, 16.906250f, 7.699219f, -12.718750f, 8.437500f, -11.031250f, 19.250000f, -10.312500f, -4.656250f, 0.197021f, -15.445312f, 6.847656f, 12.648438f, -11.234375f, -1.064453f, 2.669922f, -6.277344f, 0.580078f, -8.585938f, -3.894531f, -9.335938f, 7.480469f, 0.569824f, 14.210938f, 3.156250f, -3.578125f, 5.988281f, -6.125000f, 2.593750f, -0.386719f, -1.825195f, -4.937500f, -4.031250f, 10.468750f, -5.699219f, 0.343262f, 5.765625f, -5.796875f, 5.785156f, -7.265625f, -6.453125f, -1.804688f, 1.746094f, -3.457031f, 0.959961f, -9.398438f, -6.136719f, 19.437500f, -4.488281f, -6.074219f, 21.328125f, -4.777344f, -5.089844f, -6.906250f, 12.242188f, 5.339844f, 12.046875f, -4.417969f, -1.990234f, 17.312500f, -6.375000f, -0.398926f, -12.085938f, 20.093750f, -2.597656f, 23.296875f, 27.203125f, 1.286133f, -11.507812f, -6.402344f, -16.625000f, -1.542969f, -12.835938f, -3.986328f, 12.812500f, -11.375000f, 15.031250f, -6.750000f, -1.908203f, -4.953125f, 16.515625f, 0.504883f, 15.632812f, -0.101929f, -9.789062f, 7.046875f, 4.046875f, -11.203125f, -14.554688f, -4.582031f, -12.718750f, 15.351562f, 9.523438f, -17.812500f, 10.156250f, 12.437500f, 5.433594f, 13.156250f, -8.398438f, -10.070312f, 7.160156f, -6.675781f, 12.476562f, 6.906250f, -3.087891f, 8.750000f, -5.414062f, -23.031250f, -3.140625f, 6.410156f, -7.789062f, -4.207031f, 5.691406f, 7.156250f, 5.964844f, 0.657715f, 6.207031f, -1.045898f, -12.687500f, 10.289062f, -10.171875f, 0.721191f, -6.636719f, 10.992188f, 12.585938f, -6.968750f, -18.796875f, 3.451172f, -8.140625f, -6.917969f, 0.749512f, 8.460938f, -2.632812f, 9.140625f, 4.210938f, -4.246094f, 7.042969f, -6.207031f, -16.046875f, -8.742188f, -1.677734f, -15.000000f, 5.046875f, 9.523438f, 14.796875f, -7.613281f, 1.403320f, 3.244141f, -7.414062f, 4.527344f, -0.285400f, -0.999512f, -6.183594f, 15.242188f, -2.093750f, -2.384766f, 0.874512f, -17.312500f, -3.283203f, 19.546875f, 5.988281f, 7.097656f, -15.070312f, 17.046875f, -14.703125f, -3.468750f, 1.635742f, -7.789062f, 13.078125f, 0.293701f, 14.421875f, 8.187500f, 3.972656f, -3.830078f, -1.524414f, -4.664062f, 5.734375f, 17.718750f, -2.691406f, -8.476562f, -3.884766f, -1.282227f, -9.734375f, -4.941406f, 9.617188f, -2.148438f, -19.828125f, 0.918457f, -18.156250f, -0.033997f, -1.857422f, 25.171875f, -9.484375f, 9.015625f, -5.707031f, -2.789062f, -8.906250f, -2.771484f, 23.937500f, 6.398438f, 4.222656f, -1.660156f, 13.382812f, -5.199219f, -11.773438f, -10.742188f, -3.554688f, 13.117188f, 10.242188f, -5.996094f, -5.187500f, -0.305908f, 1.107422f, 8.265625f, -13.484375f, -1.452148f, -13.820312f, -4.765625f, -1.573242f, 3.314453f, -24.203125f, 10.656250f, -9.929688f, 11.351562f, 4.578125f, 1.315430f, -9.765625f, 7.117188f, -8.195312f, 20.187500f, -7.761719f, 6.093750f, 7.058594f, -3.119141f, -1.390625f, -0.371094f, 3.863281f, -6.035156f, -19.921875f, 14.421875f, 4.871094f, -4.195312f, 1.668945f, 7.191406f, -4.312500f, -3.480469f, 22.765625f, 16.687500f, 7.542969f, -11.476562f, -19.062500f, -17.031250f, -5.273438f, 1.240234f, -3.546875f, -2.425781f, 9.867188f, -4.039062f, 0.063171f, 15.093750f, 0.619629f, -8.593750f, 11.406250f, -12.476562f, -11.367188f, 2.779297f, -5.531250f, 19.609375f, 19.000000f, 1.332031f, -12.546875f, 4.421875f, 2.677734f, 12.132812f, -1.544922f, 4.367188f, 11.820312f, 10.468750f, 6.238281f, -5.113281f, 10.195312f, -7.035156f, -13.664062f, 7.386719f, -8.390625f, 0.609863f, 8.546875f, 0.967285f, -14.882812f, 1.910156f, 0.100525f, 1.100586f, -6.449219f, -15.796875f, -2.628906f, -0.846191f, 1.720703f, -6.527344f, 1.662109f, 6.855469f, -19.875000f, -6.484375f, -5.097656f, -4.128906f, 4.324219f, -2.316406f, -2.554688f, -3.957031f, 2.439453f, -5.859375f, 8.320312f, -2.845703f, -4.781250f, -7.746094f, -7.296875f, -5.777344f, -12.609375f, 8.992188f, -1.545898f, -2.296875f, -3.179688f, 4.769531f, -5.230469f, -0.399170f, -4.726562f, 7.679688f, -3.730469f, -11.210938f, -14.203125f, -10.257812f, -7.578125f, 13.476562f, -11.109375f, 11.781250f, 4.351562f, 5.164062f, 12.687500f, 3.572266f, 1.878906f, 10.570312f, 7.363281f, -15.328125f, -9.523438f, -6.988281f, -8.484375f, -4.351562f, -0.197998f, -6.171875f, 8.179688f, -8.617188f, -3.642578f, 9.992188f, -0.632812f, -5.046875f, -19.531250f, -8.343750f, -14.132812f, 9.210938f, 9.375000f, 6.195312f, 0.276855f, 16.578125f, -4.191406f, -14.843750f, -13.804688f, -6.992188f, -12.515625f, 9.968750f, 12.000000f, 3.099609f, -9.250000f, 3.080078f, 10.023438f, -1.319336f, -12.359375f, 9.812500f, -12.929688f, 1.218750f, -7.222656f, -7.714844f, -0.850098f, 6.917969f, -8.789062f, 3.292969f, 13.546875f, -6.308594f, 8.406250f, -0.420898f, 1.227539f, 3.572266f, 4.039062f, 8.414062f, -8.367188f, -1.160156f, -4.039062f, -2.769531f, 6.394531f, -11.437500f, -2.240234f, -1.453125f, 3.148438f, -7.800781f, 7.410156f, 13.960938f, -9.851562f, 9.687500f, -18.390625f, 9.398438f, 6.144531f, 14.515625f, 20.312500f, 18.062500f, 6.261719f, 13.515625f, 3.011719f, -21.968750f, -3.298828f, 11.890625f, 14.132812f, 4.738281f, 1.699219f, 12.523438f, -9.648438f, 16.843750f, 8.187500f, -6.953125f, 0.309326f, -2.486328f, 2.798828f, 1.089844f, 0.613281f, 13.750000f, -6.132812f, -12.351562f, 0.635742f, 7.140625f, -8.015625f, -1.620117f, 7.507812f, 1.698242f, -6.347656f, -13.578125f, 18.062500f, -11.984375f, 14.789062f, -7.695312f, -4.320312f, -15.671875f, -4.328125f, 8.062500f, -3.714844f, 1.667969f, -13.359375f, -3.050781f, -3.265625f, 27.843750f, -2.925781f, -3.367188f, 12.492188f, 2.423828f, 3.847656f, 4.234375f, -3.417969f, -1.850586f, -10.820312f, 9.875000f, -20.453125f, -17.500000f, 8.687500f, -0.216675f, 21.859375f, -7.808594f, 8.437500f, 10.937500f, -2.593750f, -0.985840f, -0.680176f, 11.187500f, 4.660156f, -5.632812f, -18.453125f, -0.446777f, -6.144531f, -10.609375f, -8.281250f, -21.281250f, -12.703125f, -15.304688f, 2.449219f, 8.625000f, 1.659180f, 11.296875f, -5.347656f, 2.361328f, -22.437500f, 9.585938f, -17.609375f, 4.914062f, -2.292969f, 13.101562f, 8.406250f, -13.312500f, -5.105469f, -2.445312f, 0.284424f, -9.343750f, -8.414062f, 6.304688f, 8.281250f, 10.414062f, 2.824219f, -12.140625f, -7.566406f, -10.562500f, -12.945312f, -11.632812f, 6.675781f, -15.257812f, 8.039062f, -9.445312f, 8.226562f, -1.281250f, -2.300781f, -11.890625f, 19.093750f, -1.015625f, -1.008789f, -2.259766f, 17.062500f, -0.434570f, -27.515625f, -6.269531f, 14.484375f, -13.578125f, 6.109375f, -4.472656f, 13.335938f, -12.492188f, -4.386719f, -3.449219f, 15.250000f, 3.761719f, 18.843750f, 5.667969f, -1.220703f, 12.757812f, 7.886719f, 6.800781f, -7.050781f, 3.582031f, 7.371094f, 10.015625f, 8.554688f, 12.835938f, 2.160156f, 5.785156f, -13.460938f, -10.414062f, -7.261719f, 0.899902f, -15.046875f, -4.273438f, 18.515625f, -5.570312f, 16.531250f, 1.872070f, -8.984375f, -7.687500f, 11.820312f, 10.164062f, 5.710938f, -3.259766f, -6.253906f, 3.880859f, -13.070312f, 5.796875f, -2.888672f, -18.343750f, -13.187500f, -5.203125f, -0.620605f, 1.786133f, 5.988281f, 21.250000f, -6.226562f, -1.081055f, 4.449219f, -9.351562f, 0.300293f, -1.865234f, -8.953125f, -5.445312f, 4.281250f, -0.047546f, 0.623535f, -18.843750f, 11.125000f, -2.191406f, -9.421875f, 1.700195f, -8.976562f, -6.167969f, 15.546875f, 0.184326f, 4.765625f, 10.695312f, 3.955078f, 6.996094f, -16.562500f, -11.476562f, 8.804688f, 6.472656f, 15.000000f, -5.246094f, 20.546875f, -0.576172f, -19.156250f, 13.968750f, -1.083008f, -16.984375f, 9.890625f, -0.235962f, -2.804688f, -11.062500f, -0.864258f, 9.421875f, -11.226562f, -5.421875f, 1.799805f, 13.953125f, 10.179688f, -12.664062f, 9.375000f, -2.578125f, 5.800781f, -4.238281f, -11.148438f, -2.564453f, 4.898438f, 12.976562f, 1.316406f, 15.789062f, -1.392578f, -3.789062f, 0.688477f, -13.648438f, -2.962891f, -8.078125f, -13.695312f, -6.488281f, 10.703125f, -18.406250f, 3.730469f, -5.132812f, -15.484375f, -14.429688f, 8.968750f, 1.581055f, 6.773438f, -2.707031f, 2.482422f, 0.613281f, -5.765625f, 2.482422f, 6.945312f, -0.509277f, 0.589355f, 2.595703f, -3.361328f, -1.528320f, -3.953125f, 7.531250f, -3.734375f, 24.265625f, 8.656250f, 10.304688f, -1.407227f, -7.351562f, -10.398438f, 9.437500f, -8.281250f, 7.308594f, -1.555664f, -10.375000f, 0.543457f, -15.703125f, -0.091003f, 0.926758f, -23.281250f, 19.609375f, 3.455078f, 5.632812f, 14.828125f, -11.046875f, 9.312500f, -0.034637f, -1.751953f, 0.197510f, 3.292969f, -6.964844f, 0.330322f, -19.171875f, -10.148438f, -13.234375f, 14.515625f, -4.058594f, -2.421875f, 13.484375f, 6.992188f, -13.390625f, 26.437500f, -9.687500f, 2.343750f, -0.951660f, -5.152344f, 9.890625f, -3.839844f, 4.628906f, 11.335938f, -7.390625f, -15.812500f, -8.835938f, 18.000000f, -21.687500f, -1.466797f, 4.906250f, 0.686523f, -15.125000f, 3.900391f, 1.581055f, -10.671875f, 0.851562f, 12.242188f, -5.906250f, 15.023438f, 6.269531f, 15.718750f, 0.282227f, -5.289062f, 3.042969f, -9.039062f, -3.910156f, 13.992188f, -17.906250f, -1.916992f, -5.441406f, -2.507812f, 8.570312f, -5.539062f, 3.417969f, -3.851562f, -2.064453f, 2.529297f, 20.109375f, -16.375000f, 15.921875f, 9.734375f, -1.242188f, -8.937500f, -4.558594f, 0.159790f, -2.265625f, 12.289062f, 5.925781f, -11.421875f, -2.748047f, 10.578125f, 3.292969f, -14.289062f, 5.871094f, -5.718750f, 4.609375f, -5.292969f, -2.865234f, 0.580566f, -16.078125f, 5.511719f, -2.351562f, 8.664062f, 19.500000f, -0.268799f, 5.832031f, -8.554688f, 4.199219f, -5.988281f, -11.460938f, 14.820312f, 7.089844f, -2.498047f, -14.953125f, 4.207031f, 8.562500f, 17.375000f, 16.765625f, -4.011719f, 10.367188f, -12.351562f, 13.765625f, -4.406250f, -1.874023f, -4.234375f, 2.298828f, -16.906250f, 14.437500f, -2.107422f, -13.421875f, -8.757812f, -1.018555f, 5.640625f, -10.648438f, 7.640625f, -14.234375f, 7.652344f, -5.312500f, -22.250000f, 14.789062f, 12.132812f, -13.218750f, -3.847656f, -8.968750f, -9.562500f, -1.368164f, 1.995117f, 9.765625f, -3.121094f, 6.929688f, 6.675781f, -7.324219f, -12.335938f, -12.859375f, -3.357422f, -21.125000f, -23.109375f, -9.656250f, 1.834961f, -6.539062f, 6.437500f, -11.390625f, 1.541016f, 18.109375f, 4.062500f, 14.742188f, -5.171875f, -0.352051f, 6.636719f, -5.554688f, -12.351562f, -7.140625f, -2.769531f, 8.593750f, 13.265625f, 9.695312f, -0.312744f, 3.761719f, -2.039062f, 17.421875f, 3.175781f, -1.450195f, 17.078125f, 0.227539f, 16.890625f, 31.953125f, 1.358398f, 13.500000f, -2.925781f, -1.355469f, 4.578125f, 8.492188f, -15.203125f, -6.671875f, -1.102539f, 6.113281f, 14.960938f, -11.531250f, 13.726562f, 3.769531f, -4.730469f, -13.812500f, 9.007812f, -5.203125f, -11.164062f, 9.789062f, -5.511719f, -3.802734f, -13.414062f, -2.794922f, 6.789062f, -2.884766f, 11.148438f, 12.906250f, 1.466797f, -8.335938f, 3.380859f, -6.511719f, -11.718750f, 8.156250f, -10.718750f, -23.156250f, 7.664062f, 1.902344f, 6.753906f, -5.953125f, -6.062500f, 10.085938f, 2.080078f, -0.894043f, -0.364746f, -0.056091f, 22.781250f, 12.101562f, 6.167969f, -1.478516f, 3.796875f, 4.066406f, -8.171875f, 24.890625f, 5.820312f, 9.984375f, -9.367188f, -3.775391f, 15.804688f, 5.171875f, -7.031250f, -9.039062f, 14.398438f, -24.750000f, 3.363281f, 11.234375f, -6.429688f, 12.929688f, -0.087036f, -0.532227f, -1.577148f, -5.156250f, 7.039062f, 9.414062f, -4.183594f, 0.413818f, -3.738281f, -2.341797f, -5.035156f, 8.546875f, -4.832031f, 2.542969f, -12.945312f, 12.718750f, 6.968750f, -6.546875f, 19.125000f, -5.597656f, 12.500000f, -3.904297f, 0.145386f, 4.343750f, -3.132812f, -7.007812f, -10.703125f, -8.945312f, -0.194214f, 8.156250f, 8.820312f, -6.511719f, 18.796875f, 9.242188f, 1.225586f, -5.214844f, 6.207031f, 15.562500f, 2.300781f, -7.152344f, -0.384033f, 2.673828f, -8.906250f, 5.457031f, 13.375000f, -12.515625f, -2.345703f, 8.296875f, 7.988281f, -3.806641f, 9.210938f, -12.812500f, -5.960938f, -9.828125f, -4.992188f, -1.688477f, -3.253906f, 2.742188f, 10.757812f, -6.015625f, -7.687500f, -15.492188f, -9.164062f, -0.221069f, -5.507812f, -8.117188f, -12.023438f, 30.984375f, -13.789062f, 0.152710f, -4.011719f, -2.265625f, -1.034180f, -1.359375f, 0.858398f, 5.000000f, 20.281250f, -11.593750f, 10.515625f, 0.565918f, -7.339844f, -12.640625f, -1.955078f, 0.746582f, 0.140503f, -8.148438f, 9.500000f, -17.781250f, -5.980469f, -7.097656f, 9.148438f, -9.281250f, 3.199219f, -4.667969f, 7.765625f, -0.014717f, 0.671875f, 6.875000f, -10.296875f, -9.562500f, -7.941406f, 0.910156f, -2.591797f, 1.506836f, 6.398438f, 5.277344f, -2.828125f, 11.890625f, 2.087891f, -13.609375f, 19.359375f, 4.406250f, 13.820312f, -6.171875f, -5.757812f, 11.343750f, -0.698730f, 1.055664f, 8.992188f, 2.195312f, 6.812500f, 9.046875f, 9.414062f, 10.609375f, 3.507812f, -7.882812f, 1.717773f, 9.687500f, 3.798828f, 6.355469f, -21.140625f, 0.019165f, 1.480469f, 6.230469f, 6.761719f, 5.527344f, 3.316406f, 9.265625f, 19.546875f, -0.415283f, -5.027344f, 21.890625f, -9.601562f, -7.027344f, 3.500000f, 12.585938f, 1.292969f, -7.382812f, -2.568359f, -19.187500f, 2.605469f, 1.473633f, 25.718750f, 6.257812f, 14.578125f, -13.906250f, 5.046875f, 8.640625f, -6.062500f, -5.355469f, 4.984375f, 2.701172f, -13.648438f, 3.833984f, 3.339844f, 8.796875f, 5.730469f, -2.386719f, 14.453125f, -0.343506f, 19.109375f, -8.093750f, -3.166016f, 7.156250f, 7.070312f, 1.387695f, 12.812500f, 6.789062f, 2.355469f, 1.478516f, -5.496094f, -16.328125f, -8.812500f, 13.562500f, 5.660156f, -16.671875f, 3.882812f, -2.058594f, 12.750000f, -12.812500f, 22.562500f, 28.437500f, 6.023438f, -10.867188f, -1.601562f, 11.937500f, 13.968750f, 4.335938f, -0.108276f, -6.730469f, -13.820312f, 1.097656f, -9.953125f, 8.609375f, -13.617188f, -3.929688f, -9.773438f, 17.875000f, 4.851562f, 18.468750f, 13.382812f, -11.023438f, 10.710938f, 6.828125f, -7.199219f, 22.500000f, 0.128296f, 5.726562f, -9.257812f, -29.328125f, -21.593750f, 9.460938f, -5.714844f, -8.328125f, 4.707031f, 11.031250f, 19.140625f, -5.921875f, -4.164062f, 14.343750f, -9.539062f, -7.101562f, -5.382812f, -7.031250f, 9.757812f, -13.226562f, -3.529297f, 10.015625f, -12.476562f, 1.734375f, 1.601562f, 5.332031f, -3.941406f, 3.576172f, -0.900879f, 12.835938f, 22.859375f, -10.781250f, 10.289062f, -13.992188f, 2.431641f, 0.093750f, 8.000000f, -36.375000f, 2.498047f, -6.730469f, -3.281250f, -2.820312f, 19.562500f, -6.015625f, 1.492188f, 1.810547f, 20.250000f, 13.343750f, -2.326172f, 15.648438f, -3.730469f, -13.484375f, 2.466797f, -9.468750f, 0.989258f, -7.683594f, -0.133423f, 0.840820f, 4.636719f, -10.031250f, 17.156250f, -1.267578f, -3.835938f, 6.417969f, 5.539062f, 11.710938f, -14.117188f, -3.625000f, 2.582031f, 2.255859f, -0.622559f, 6.234375f, 2.570312f, 6.242188f, -6.929688f, 5.945312f, -18.984375f, -0.716309f, -11.804688f, 11.429688f, 1.454102f, -16.187500f, -8.429688f, -1.072266f, -8.820312f, 9.945312f, 0.406494f, -9.007812f, -17.265625f, -19.984375f, 9.031250f, 25.000000f, 8.148438f, 6.148438f, -17.062500f, -10.367188f, 2.166016f, -11.804688f, -1.177734f, -8.632812f, -0.296387f, -6.039062f, -1.783203f, 9.710938f, 6.683594f, 5.867188f, 2.521484f, 24.187500f, -8.687500f, -15.328125f, -8.562500f, -0.498779f, -0.788574f, -5.953125f, 3.527344f, -8.343750f, -4.285156f, 7.933594f, 10.734375f, 9.382812f, -24.390625f, 4.367188f, -13.812500f, -7.070312f, -8.531250f, -7.125000f, -5.195312f, 20.656250f, -5.281250f, -8.500000f, -17.843750f, -7.289062f, 9.945312f, -7.601562f, 19.765625f, -15.703125f, -10.500000f, 10.593750f, 3.435547f, -12.765625f, -4.773438f, -0.403564f, 22.984375f, 0.539551f, 5.085938f, -5.718750f, -12.843750f, -26.500000f, -0.130615f, -24.656250f, 13.351562f, -21.484375f, 10.484375f, 13.109375f, 4.910156f, -9.562500f, -2.431641f, -12.140625f, -2.650391f, 12.898438f, 6.011719f, -6.726562f, 13.796875f, -26.046875f, -16.625000f, 11.109375f, 0.889160f, -0.392334f, 9.671875f, 18.046875f, -0.840820f, -21.203125f, 3.263672f, -8.718750f, 10.265625f, -5.097656f, -7.964844f, -24.281250f, -21.984375f, -8.937500f, 8.718750f, -12.750000f, 4.718750f, -0.570801f, -9.656250f, 4.132812f, 0.498535f, -1.223633f, -25.062500f, 4.863281f, 12.914062f, 9.406250f, 0.372803f, -1.215820f, 19.546875f, 0.355957f, 4.507812f, -11.218750f, -23.203125f, 25.343750f, -5.304688f, 8.968750f, -14.968750f, -10.640625f, 1.415039f, 4.015625f, -1.480469f, 8.070312f, -20.250000f, 3.171875f, -6.535156f, 3.763672f, 7.585938f, -2.466797f, -15.296875f, 7.453125f, -15.945312f, 6.652344f, 2.740234f, -14.359375f, -11.289062f, -6.082031f, 5.613281f, 0.346436f, -8.062500f, 3.158203f, -10.023438f, 2.832031f, -0.825195f, -11.492188f, -1.419922f, -6.867188f, -10.679688f, 1.885742f, 7.304688f, -7.570312f, -4.250000f, -9.210938f, -6.433594f, -3.183594f, -4.808594f, 2.896484f, 9.304688f, 2.253906f, -8.421875f, 16.406250f, 1.214844f, 8.828125f, -6.593750f, 8.164062f, 8.781250f, -27.875000f, -7.871094f, 24.062500f, 0.880859f, -8.015625f, -21.187500f, 0.226318f, 0.752930f, 4.398438f, 0.457275f, 3.308594f, -14.718750f, 10.281250f, 7.878906f, 7.652344f, -4.257812f, -5.242188f, 8.476562f, -7.078125f, -4.445312f, 8.992188f, 21.375000f, 5.609375f, 3.671875f, 0.896484f, -8.937500f, 8.937500f, 2.187500f, 0.033173f, 13.375000f, 11.281250f, 21.187500f, -18.781250f, -7.058594f, -0.567871f, 0.385254f, 1.898438f, 1.793945f, -0.646484f, -15.132812f, -17.312500f, -0.500977f, 5.144531f, 14.851562f, 0.562012f, 4.535156f, 10.023438f, -20.500000f, 3.279297f, 13.632812f, 14.046875f, 6.335938f, 15.710938f, 5.238281f, 8.031250f, 2.060547f, -0.875977f, -0.899902f, 2.986328f, -2.234375f, 15.585938f, 19.578125f, 0.311768f, -15.656250f, 12.898438f, 22.734375f, 10.523438f, -17.156250f, 14.882812f, 12.718750f, -10.367188f, 15.125000f, 6.281250f, 0.270264f, 0.123047f, 0.799316f, 4.789062f, 13.500000f, -12.156250f, -14.554688f, 6.437500f, 23.593750f, 4.984375f, 5.175781f, -6.843750f, -6.242188f, 12.101562f, -18.609375f, 4.054688f, 6.761719f, -8.281250f, -8.164062f, 5.886719f, 8.859375f, 9.718750f, -3.767578f, 0.114197f, -18.218750f, 5.820312f, 14.132812f, -2.074219f, 3.027344f, 8.945312f, -13.953125f, 5.488281f, -2.904297f, 1.985352f, 8.531250f, 2.458984f, 7.308594f, 0.735352f, 17.781250f, 9.125000f, -14.351562f, 1.124023f, -2.464844f, 4.851562f, -13.460938f, 2.951172f, -8.500000f, 5.035156f, 2.232422f, -2.369141f, -2.789062f, -5.039062f, -0.898438f, 13.187500f, -7.097656f, -22.390625f, 3.138672f, 16.812500f, -6.503906f, -20.625000f, -6.691406f, 20.250000f, -0.689453f, -2.650391f, -0.799316f, -1.297852f, 8.593750f, -1.822266f, -8.570312f, -14.507812f, -12.601562f, 6.597656f, -1.354492f, 5.351562f, -5.203125f, 6.398438f, 5.335938f, 10.507812f, -1.365234f, -1.467773f, -28.515625f, -5.593750f, 11.156250f, 6.097656f, -2.158203f, 1.383789f, -6.433594f, 9.804688f, -10.132812f, 1.630859f, -9.312500f, -19.593750f, 0.281982f, 0.067749f, 14.671875f, -10.578125f, -6.722656f, 5.445312f, -5.917969f, 1.805664f, -1.485352f, -9.117188f, -11.078125f, 11.398438f, 9.750000f, 13.828125f, 4.566406f, 14.601562f, 11.312500f, 3.306641f, -10.781250f, -26.718750f, -0.736816f, 0.450195f, -4.312500f, 6.558594f, -6.472656f, -21.500000f, -2.626953f, 4.773438f, -5.406250f, 15.054688f, 8.210938f, -3.347656f, 3.181641f, -20.171875f, 5.007812f, 9.429688f, -3.148438f, -1.671875f, 26.984375f, 12.046875f, -7.179688f, 12.296875f, 8.351562f, -9.726562f, -4.265625f, 18.375000f, 6.675781f, -6.808594f, 1.518555f, 0.787109f, -4.261719f, -17.203125f, 3.748047f, -10.945312f, -11.054688f, -22.921875f, -0.262207f, -10.437500f, -19.593750f, 13.179688f, -6.007812f, 5.429688f, -9.304688f, -7.753906f, -12.984375f, -12.750000f, 2.910156f, -7.226562f, -5.453125f, -10.117188f, -13.500000f, 19.312500f, 34.718750f, -0.804199f, -5.785156f, 4.410156f, -8.523438f, -1.242188f, -5.855469f, 9.078125f, 20.312500f, -1.139648f, 0.381348f, -6.441406f, -9.539062f, -14.281250f, 10.562500f, -4.246094f, 4.570312f, 5.347656f, -8.148438f, -13.000000f, 10.070312f, 0.846680f, -6.667969f, -0.285889f, -2.193359f, 3.453125f, -4.746094f, -3.087891f, 0.378906f, -1.691406f, 5.492188f, 15.132812f, 13.679688f, -5.253906f, -13.554688f, 5.515625f, 10.781250f, 5.519531f, 3.058594f, 2.404297f, 3.597656f, 2.574219f, 1.456055f, 9.109375f, -9.476562f, -1.840820f, -3.576172f, 11.570312f, -5.082031f, 31.515625f, -7.289062f, 3.558594f, 0.423828f, 11.093750f, -9.328125f, -5.058594f, -6.984375f, -10.468750f, 4.621094f, -0.903809f, 6.441406f, 7.000000f, -7.101562f, 2.244141f, -4.539062f, 6.230469f, -10.203125f, -2.234375f, 2.890625f, -6.058594f, -28.250000f, 17.515625f, 1.563477f, -4.269531f, -1.026367f, 10.640625f, -8.046875f, -7.097656f, -0.536133f, -7.257812f, -2.958984f, 14.343750f, 20.203125f, 2.578125f, -0.061340f, -7.898438f, -17.328125f, -10.250000f, -14.304688f, -21.031250f, 12.218750f, -1.432617f, 5.437500f, 0.639160f, 1.412109f, 2.324219f, -16.718750f, 10.367188f, -7.996094f, 1.524414f, -3.326172f, -18.687500f, -3.923828f, -0.157227f, -8.867188f, 5.890625f, -14.234375f, -6.281250f, 2.720703f, -13.203125f, -7.660156f, 15.578125f, 4.988281f, 10.664062f, -19.656250f, -8.031250f, -1.439453f, -7.027344f, 5.679688f, -0.709961f, -3.298828f, 3.939453f, 8.132812f, -4.328125f, -13.726562f, -4.769531f, -4.406250f, -6.964844f, -27.281250f, 2.279297f, 19.578125f }; +static const float16 vec_b[] = { 1.131836f, 6.109375f, 2.093750f, -3.322266f, 7.148438f, 6.871094f, 6.125000f, 2.326172f, 1.839844f, -16.234375f, 4.703125f, 23.531250f, -0.490234f, -18.140625f, -0.875977f, -22.937500f, 8.554688f, -12.148438f, 0.088135f, -1.610352f, -3.708984f, -3.730469f, -7.257812f, 16.375000f, -16.968750f, -3.378906f, -9.757812f, 19.062500f, 6.171875f, 11.460938f, -6.437500f, -18.718750f, 11.726562f, 16.906250f, -21.109375f, 23.640625f, 3.892578f, -1.548828f, -4.906250f, -14.296875f, 13.804688f, -8.140625f, -9.570312f, 1.446289f, -15.703125f, 3.154297f, -4.312500f, 4.996094f, -0.661133f, -2.488281f, -4.804688f, -1.555664f, 7.792969f, -7.734375f, -0.093262f, -0.832520f, -9.421875f, 8.726562f, 9.781250f, 2.849609f, 5.042969f, -16.359375f, 18.843750f, 8.617188f, 18.375000f, 11.750000f, -8.375000f, 7.011719f, 11.757812f, 3.486328f, -10.921875f, 1.370117f, -6.898438f, -6.988281f, -2.824219f, 4.945312f, -1.469727f, 6.972656f, -14.757812f, 3.603516f, 4.769531f, -17.343750f, 7.148438f, -15.781250f, 14.054688f, -8.570312f, 6.554688f, 19.109375f, 8.234375f, 3.593750f, 11.625000f, -1.319336f, 1.082031f, 5.972656f, -8.445312f, -21.171875f, -9.109375f, -0.744141f, 3.388672f, 1.438477f, 9.789062f, 16.718750f, -1.168945f, 1.392578f, -11.593750f, -1.593750f, 2.216797f, -6.539062f, 12.617188f, -30.531250f, -2.285156f, 16.734375f, -12.101562f, 5.632812f, 4.054688f, -1.842773f, -9.382812f, -18.062500f, 14.554688f, -8.859375f, -5.019531f, 22.734375f, 7.250000f, 15.101562f, -15.562500f, 5.707031f, 3.109375f, 15.757812f, -22.625000f, -18.468750f, -3.916016f, -8.203125f, -11.203125f, -17.484375f, 0.120972f, 8.609375f, 4.941406f, 0.627930f, -0.717773f, 10.601562f, -1.115234f, -2.185547f, 25.921875f, -4.902344f, 3.296875f, 4.070312f, 13.578125f, 9.765625f, 8.500000f, -13.273438f, -19.390625f, 6.300781f, -12.828125f, -2.320312f, 1.954102f, -8.398438f, -7.878906f, 5.675781f, -15.906250f, 3.884766f, 3.384766f, -15.718750f, -7.078125f, -5.984375f, -11.507812f, 4.203125f, 5.539062f, 4.769531f, -2.386719f, -9.093750f, 14.054688f, -3.400391f, -8.828125f, 17.703125f, 30.562500f, 1.332031f, -2.207031f, -1.166016f, 13.445312f, -11.609375f, 0.790039f, 16.625000f, 4.210938f, 4.382812f, 11.984375f, -0.997559f, 16.343750f, 1.234375f, 6.320312f, -10.671875f, -14.437500f, -9.898438f, -13.109375f, 5.000000f, -7.777344f, 0.764648f, 6.906250f, 2.392578f, -6.359375f, 6.191406f, -10.195312f, 2.646484f, -13.476562f, 0.841797f, -3.269531f, 0.552734f, 2.771484f, 6.914062f, 17.812500f, -2.183594f, -8.992188f, 14.367188f, -6.093750f, 4.503906f, -13.289062f, 24.484375f, -0.339600f, 6.761719f, 4.714844f, 11.742188f, 10.250000f, -9.273438f, -13.671875f, 16.312500f, -0.493164f, 5.015625f, -3.855469f, 7.453125f, -7.378906f, -5.476562f, -8.507812f, 11.429688f, -24.328125f, 5.632812f, -4.742188f, 2.910156f, 10.867188f, 11.703125f, 8.593750f, 0.354492f, -1.727539f, -12.757812f, 2.066406f, 4.828125f, -6.308594f, 4.089844f, -8.437500f, 4.796875f, -21.562500f, -10.460938f, 19.593750f, -4.160156f, -6.250000f, -5.894531f, 10.484375f, 9.640625f, -4.226562f, 14.843750f, 5.539062f, -12.593750f, 0.202148f, 5.039062f, 5.773438f, 10.601562f, 5.269531f, 8.609375f, 3.349609f, -2.708984f, -13.820312f, 1.959961f, 1.439453f, -9.695312f, 2.634766f, -4.949219f, -4.000000f, -5.125000f, -5.132812f, 6.820312f, -17.984375f, -1.672852f, -2.019531f, -22.187500f, 3.441406f, -0.466797f, 12.242188f, -9.093750f, 6.152344f, 14.148438f, 9.914062f, -5.121094f, -7.265625f, -10.289062f, -8.445312f, 4.523438f, -4.082031f, -5.753906f, 4.332031f, 2.708984f, -8.906250f, -4.121094f, 21.171875f, -3.464844f, -7.046875f, -10.218750f, 6.382812f, 2.931641f, 20.671875f, -11.304688f, -0.181641f, 0.625000f, -11.265625f, 2.890625f, -9.515625f, -10.460938f, 20.687500f, -5.714844f, -14.281250f, -3.855469f, -5.015625f, 16.796875f, -2.220703f, 0.985840f, 10.578125f, -9.773438f, 14.726562f, 0.469482f, -8.531250f, -13.390625f, -10.835938f, -7.109375f, 7.457031f, -7.710938f, -11.359375f, -1.564453f, -7.117188f, -12.804688f, -12.203125f, 1.235352f, -3.953125f, -9.414062f, 18.875000f, -3.859375f, -5.976562f, -0.689941f, 2.933594f, 1.472656f, 0.053802f, 6.828125f, -8.039062f, -4.933594f, -9.835938f, -2.228516f, -10.093750f, 16.093750f, -3.720703f, -0.451660f, -3.013672f, 2.142578f, 4.972656f, -14.328125f, 11.710938f, -2.263672f, 3.203125f, -6.304688f, -5.449219f, 13.132812f, 4.406250f, 7.777344f, 10.093750f, 16.593750f, -12.039062f, -2.130859f, -1.020508f, -6.785156f, 16.812500f, -11.351562f, 3.779297f, 7.347656f, -4.757812f, -2.710938f, 7.968750f, 0.707031f, 16.187500f, -0.509766f, 2.697266f, 7.519531f, 0.690430f, -4.011719f, -4.992188f, -9.554688f, 7.714844f, -2.357422f, 10.960938f, 14.578125f, -0.623047f, -10.140625f, 12.796875f, 0.353271f, -11.539062f, 4.253906f, 17.500000f, -10.945312f, -12.000000f, -0.251221f, 3.056641f, -7.933594f, -5.882812f, -2.277344f, -10.375000f, -5.246094f, -7.320312f, -1.326172f, 19.890625f, 5.117188f, -0.162354f, -2.498047f, 10.367188f, -7.531250f, 2.511719f, -1.507812f, -7.687500f, 8.781250f, 6.894531f, 2.582031f, -11.968750f, 4.136719f, -18.546875f, 6.230469f, -3.781250f, 16.046875f, 5.039062f, -15.617188f, -6.117188f, 17.343750f, 1.271484f, 5.578125f, 10.539062f, -2.537109f, 6.625000f, -5.507812f, -3.677734f, -5.164062f, -17.312500f, -0.700195f, 9.546875f, -0.127441f, -5.121094f, 14.453125f, -17.562500f, -13.625000f, 4.730469f, -7.730469f, -21.968750f, -0.182007f, 9.335938f, 14.484375f, -8.414062f, -14.187500f, 2.152344f, 1.048828f, 3.630859f, -1.461914f, 6.355469f, 1.981445f, -5.402344f, 6.507812f, 3.568359f, 8.460938f, -15.421875f, 12.062500f, -3.369141f, -10.304688f, 2.695312f, 6.269531f, 13.750000f, 13.492188f, 2.826172f, 12.671875f, -11.125000f, 2.414062f, -19.796875f, -2.943359f, 28.000000f, -6.027344f, 4.683594f, -17.671875f, 13.687500f, -21.812500f, 3.431641f, -10.320312f, 8.820312f, -5.527344f, 26.828125f, 3.720703f, 7.742188f, -4.113281f, -1.512695f, -7.410156f, -3.998047f, 13.054688f, 6.070312f, -9.203125f, 7.808594f, 1.910156f, 8.218750f, -7.500000f, -16.531250f, -4.777344f, 0.998535f, 0.976562f, -0.378174f, 11.578125f, 14.750000f, 18.515625f, -4.148438f, 9.820312f, 0.732910f, -16.500000f, 3.689453f, -11.000000f, 19.921875f, -8.296875f, 0.124573f, -3.060547f, -3.009766f, 3.208984f, 10.148438f, -4.867188f, -9.789062f, -0.625000f, 2.744141f, -8.062500f, 17.015625f, 9.585938f, 5.457031f, 2.294922f, 4.027344f, -2.173828f, -8.562500f, 4.656250f, -11.953125f, -4.625000f, -2.626953f, 9.187500f, 7.261719f, 0.801270f, 3.972656f, -10.500000f, -4.710938f, 12.539062f, -19.281250f, -17.906250f, -9.742188f, -3.242188f, -7.835938f, -15.328125f, 6.722656f, 11.250000f, -2.402344f, -5.792969f, -5.871094f, 11.750000f, 6.578125f, 5.363281f, 15.828125f, -9.109375f, 10.171875f, 2.238281f, 1.850586f, 1.082031f, -5.609375f, 10.359375f, 9.226562f, -5.847656f, 7.523438f, -8.687500f, -3.888672f, 12.320312f, 3.912109f, -15.093750f, -1.823242f, 9.257812f, 7.250000f, -0.217285f, -4.468750f, 0.417480f, 0.349365f, 0.915527f, 0.726074f, 0.724121f, -16.203125f, 24.781250f, 5.949219f, -3.496094f, -7.550781f, -12.554688f, 3.894531f, 9.640625f, 11.265625f, 5.128906f, 16.296875f, 3.937500f, 14.468750f, -3.259766f, -3.367188f, -5.929688f, -1.206055f, 0.617188f, 1.592773f, -21.359375f, -6.031250f, 2.974609f, 2.039062f, 12.179688f, 2.804688f, -4.113281f, -5.847656f, 1.258789f, -11.476562f, -11.078125f, -11.117188f, 0.634277f, -8.851562f, 4.671875f, -5.023438f, -2.705078f, 6.597656f, 1.671875f, 13.007812f, -11.289062f, -3.042969f, 0.034149f, 10.851562f, -4.886719f, -4.730469f, 13.398438f, 0.687500f, 1.302734f, -8.984375f, -11.625000f, -4.218750f, 4.902344f, 10.429688f, -12.781250f, 14.242188f, 11.703125f, -0.440674f, 3.697266f, 11.101562f, -12.046875f, -1.641602f, 18.656250f, 12.710938f, 13.437500f, -1.175781f, 8.359375f, -10.593750f, 20.468750f, 5.472656f, 3.103516f, -2.441406f, -6.726562f, 3.220703f, -11.765625f, -13.250000f, -9.015625f, 13.421875f, 11.226562f, -15.648438f, -6.824219f, 10.570312f, 1.852539f, 2.830078f, -17.562500f, 0.304199f, -2.447266f, -1.648438f, 8.140625f, 3.835938f, -14.007812f, -1.449219f, -16.078125f, -3.417969f, 4.566406f, 3.875000f, 15.453125f, -1.203125f, -4.628906f, -14.835938f, -1.909180f, 3.814453f, 6.746094f, 10.632812f, 1.440430f, 13.984375f, 9.187500f, 5.449219f, 4.925781f, 21.359375f, -6.468750f, 19.515625f, -4.097656f, 1.427734f, -5.335938f, 0.586426f, -17.796875f, -3.279297f, 3.355469f, -13.570312f, 1.068359f, -1.681641f, 16.453125f, -0.960938f, 6.371094f, -1.668945f, 1.835938f, 2.132812f, 5.523438f, -8.750000f, 1.216797f, 7.023438f, -8.218750f, 17.390625f, -2.367188f, -3.412109f, -17.312500f, -22.109375f, -7.859375f, -22.921875f, 13.773438f, -13.468750f, -1.077148f, 1.228516f, -7.335938f, 4.148438f, -0.246704f, -0.892090f, -5.804688f, 10.093750f, 4.871094f, -6.023438f, 0.938965f, -17.875000f, -6.121094f, -3.585938f, -5.382812f, -4.488281f, -6.277344f, 1.338867f, 4.007812f, 4.121094f, -10.890625f, -4.671875f, -6.808594f, 5.859375f, -13.875000f, -9.281250f, 7.250000f, -6.292969f, -3.867188f, -6.000000f, -14.250000f, -0.481201f, -5.222656f, 0.299805f, -6.996094f, -6.539062f, -9.140625f, -2.568359f, 3.021484f, -2.162109f, -0.162720f, -11.796875f, -11.304688f, 9.476562f, 1.953125f, 2.812500f, -21.562500f, -6.464844f, 13.015625f, 0.646484f, -4.492188f, -1.800781f, 3.062500f, 11.414062f, -12.101562f, -4.562500f, -22.312500f, -11.257812f, 11.578125f, 7.648438f, -3.365234f, -5.894531f, 12.320312f, 4.253906f, -1.457031f, -3.060547f, 3.193359f, -8.054688f, -2.945312f, -8.992188f, -7.863281f, -0.013435f, 4.144531f, 4.843750f, -2.718750f, -3.537109f, -3.287109f, 6.457031f, 3.205078f, -2.576172f, -18.312500f, 2.162109f, -20.046875f, -5.164062f, 1.650391f, -10.507812f, -16.562500f, -5.390625f, 15.164062f, -7.085938f, 0.053192f, -2.871094f, -6.218750f, 2.546875f, -13.859375f, -11.554688f, -13.960938f, 13.960938f, 10.734375f, 10.390625f, -4.304688f, 10.867188f, 7.960938f, -7.496094f, -0.936035f, -1.507812f, -8.992188f, -4.656250f, 10.421875f, -2.361328f, 10.039062f, -12.773438f, -12.289062f, 11.375000f, 1.850586f, -4.132812f, 4.183594f, 2.445312f, -5.234375f, 9.078125f, 13.664062f, 9.609375f, 8.625000f, -3.480469f, -1.222656f, 4.894531f, 5.246094f, 1.776367f, -7.921875f, 2.214844f, -8.742188f, -2.619141f, -1.509766f, 6.828125f, -1.524414f, -13.570312f, -9.007812f, 6.105469f, -4.390625f, -0.143311f, 3.089844f, 6.734375f, -6.648438f, -4.707031f, -0.087646f, 13.507812f, 8.984375f, -14.257812f, -14.914062f, 14.226562f, -0.010422f, -17.125000f, -6.175781f, 3.917969f, 0.427979f, 0.601074f, 6.632812f, -3.433594f, -6.550781f, 8.328125f, -16.062500f, -2.904297f, 12.031250f, -6.824219f, -0.365967f, 5.007812f, -2.167969f, -3.546875f, -9.320312f, -11.000000f, -12.070312f, -14.992188f, 16.328125f, 28.578125f, -3.861328f, -9.226562f, -2.126953f, -8.093750f, -11.851562f, 15.304688f, 9.992188f, 8.414062f, -2.486328f, 0.381348f, -4.500000f, 11.523438f, 20.078125f, -3.392578f, -1.460938f, -8.390625f, 7.328125f, -7.261719f, 3.201172f, 6.582031f, -17.171875f, 19.437500f, -3.568359f, -5.769531f, -1.015625f, -2.945312f, 6.332031f, -8.484375f, -4.062500f, -8.054688f, -1.069336f, -12.570312f, 12.101562f, 1.878906f, 3.492188f, 6.988281f, -0.285400f, 8.187500f, -16.890625f, -18.703125f, -9.335938f, -3.359375f, -9.578125f, 2.275391f, -4.777344f, -3.337891f, 12.703125f, 9.710938f, 0.392578f, 13.414062f, 10.437500f, -2.175781f, 6.835938f, 11.726562f, 4.621094f, -6.167969f, -9.273438f, -1.047852f, 15.687500f, 13.273438f, -2.068359f, -1.963867f, 2.480469f, -9.632812f, -21.625000f, -3.687500f, 13.453125f, 0.978027f, -13.710938f, -7.921875f, -8.664062f, -2.042969f, -4.425781f, -8.117188f, 8.929688f, -6.898438f, -12.734375f, -19.937500f, -4.847656f, 4.835938f, -12.398438f, -7.671875f, -7.722656f, 3.158203f, 11.437500f, 3.664062f, -27.578125f, 8.476562f, 15.101562f, 13.437500f, 20.578125f, 5.382812f, 13.000000f, -0.578613f, -0.751953f, -7.277344f, -14.125000f, -2.734375f, 4.054688f, -12.796875f, 0.659668f, -9.734375f, 6.300781f, 2.894531f, 7.093750f, 3.041016f, 7.910156f, -24.140625f, 2.808594f, 14.500000f, -3.802734f, -13.460938f, 1.401367f, -0.143555f, 5.964844f, 6.675781f, 1.637695f, 0.307861f, -8.554688f, -15.984375f, 6.878906f, -6.015625f, -5.238281f, -7.066406f, 17.921875f, 15.054688f, 0.297363f, -16.125000f, 10.007812f, 7.523438f, -1.403320f, -12.984375f, 0.214600f, -8.992188f, 0.746582f, -3.248047f, 3.648438f, -1.318359f, 7.054688f, 9.828125f, -4.964844f, 3.527344f, -5.738281f, 9.015625f, 2.011719f, 7.195312f, 4.113281f, -2.564453f, 16.046875f, 2.462891f, -6.566406f, 5.425781f, -5.402344f, -2.167969f, 2.167969f, 17.937500f, 3.107422f, 3.935547f, -8.257812f, -3.050781f, -14.820312f, 14.187500f, 17.671875f, 18.062500f, -12.062500f, 3.681641f, -8.890625f, 1.799805f, -18.484375f, -7.007812f, -23.359375f, 10.398438f, -4.867188f, 2.029297f, 0.243652f, 9.882812f, 9.234375f, 9.593750f, -13.953125f, 12.906250f, -5.886719f, -3.189453f, -22.234375f, 4.199219f, 5.562500f, 8.507812f, 18.859375f, 1.312500f, 11.132812f, 15.367188f, 12.445312f, -8.531250f, 6.652344f, 7.910156f, 12.968750f, -13.398438f, -20.531250f, -2.748047f, 5.371094f, 3.044922f, -6.105469f, -13.164062f, -9.867188f, 3.566406f, 7.242188f, -20.218750f, -13.812500f, -2.103516f, -5.898438f, -10.656250f, -18.750000f, 7.906250f, 4.113281f, -12.890625f, -7.105469f, 13.460938f, -15.992188f, 3.611328f, 2.626953f, -1.838867f, 18.593750f, -8.804688f, 1.431641f, 15.398438f, 4.101562f, -2.572266f, -10.460938f, -6.152344f, 16.609375f, -5.960938f, 7.226562f, 9.609375f, -24.343750f, 18.406250f, 6.402344f, 0.636230f, -1.091797f, 2.783203f, -0.231079f, 11.945312f, 2.378906f, -2.330078f, 1.351562f, -2.423828f, 12.226562f, 8.796875f, 9.390625f, -8.289062f, 0.511719f, 1.365234f, 3.087891f, -4.914062f, 1.901367f, 12.468750f, 0.159180f, 4.800781f, 3.748047f, -0.082825f, -4.101562f, 14.750000f, -5.820312f, -3.429688f, 24.718750f, 30.250000f, -6.785156f, 2.703125f, -3.664062f, 1.665039f, 1.109375f, -2.734375f, -0.119019f, -4.863281f, 5.292969f, -7.425781f, 12.523438f, -6.457031f, 17.750000f, -1.216797f, -10.210938f, -6.394531f, -10.968750f, 0.717285f, 6.308594f, 1.257812f, -1.912109f, -2.736328f, 9.687500f, -0.408936f, 0.526855f, -8.593750f, 15.132812f, 3.976562f, -10.250000f, 1.744141f, -2.257812f, -2.257812f, 22.250000f, -2.246094f, -0.832031f, 13.335938f, -16.765625f, 9.632812f, 7.125000f, -8.382812f, 11.640625f, -6.289062f, -0.278809f, 5.394531f, 1.989258f, -0.907227f, -8.648438f, -0.577637f, 9.484375f, 12.156250f, -5.796875f, 10.093750f, -0.526855f, -12.398438f, -4.675781f, -6.261719f, -6.097656f, -5.230469f, -16.640625f, -6.210938f, -2.806641f, 13.773438f, -4.402344f, -9.289062f, -14.421875f, -3.628906f, -6.820312f, 7.531250f, 4.675781f, -24.234375f, -3.785156f, -0.126953f, -11.031250f, 6.062500f, -1.961914f, -1.720703f, 8.921875f, 11.789062f, 9.203125f, 9.640625f, 3.234375f, 5.058594f, -7.839844f, 0.149780f, 15.976562f, 8.578125f, 5.656250f, -15.976562f, -3.330078f, -9.023438f, -16.640625f, 1.863281f, 2.037109f, 20.859375f, 1.063477f, -5.574219f, -5.289062f, -13.250000f, -14.632812f, -8.835938f, -25.203125f, 9.625000f, 7.085938f, -2.464844f, -12.140625f, 9.796875f, 0.330811f, -8.460938f, 5.695312f, 9.000000f, 23.843750f, -10.335938f, -3.339844f, -6.285156f, 3.925781f, -12.859375f, -2.066406f, -21.500000f, -7.488281f, -3.958984f, 2.798828f, -9.054688f, -27.109375f, 4.773438f, 6.203125f, 8.593750f, 5.882812f, -8.726562f, 7.406250f, -6.609375f, -4.253906f, -2.849609f, 0.671387f, 4.214844f, -9.687500f, -10.578125f, -7.906250f, 5.113281f, -3.427734f, 19.578125f, 7.003906f, -13.929688f, -2.462891f, -6.906250f, -10.593750f, 16.750000f, -0.988770f, -2.187500f, 5.695312f, 13.203125f, -10.609375f, 21.468750f, -1.658203f, -5.210938f, 23.406250f, 0.646973f, -15.429688f, -11.914062f, 3.132812f, 8.679688f, 30.562500f, -0.248169f, 10.960938f, 4.082031f, -6.152344f, -1.837891f, -16.109375f, 19.187500f, -11.203125f, -8.046875f, 18.593750f, -9.781250f, 7.203125f, 6.546875f, 4.121094f, -6.117188f, -24.218750f, 6.363281f, -17.250000f, 0.157104f, -15.578125f, 1.067383f, 4.015625f, 2.878906f, -26.281250f, -6.234375f, -5.882812f, 4.375000f, 8.062500f, -10.781250f, -9.148438f, 1.250977f, 7.363281f, 0.524414f, 1.513672f, -3.490234f, 4.972656f, -6.363281f, 12.734375f, 2.570312f, -7.476562f, 1.382812f, -16.265625f, 15.062500f, 1.976562f, -4.269531f, -11.320312f, -3.914062f, -0.600586f, 7.722656f, -2.472656f, -2.923828f, -6.515625f, 8.968750f, 4.179688f, -13.796875f, -0.821289f, 8.421875f, -8.585938f, -5.750000f, -10.210938f, 2.574219f, -3.623047f, 7.132812f, 3.119141f, -11.000000f, 12.898438f, 18.546875f, -7.695312f, -5.003906f, -14.117188f, -10.890625f, -6.429688f, -10.742188f, 3.093750f, 0.568359f, -9.546875f, 7.703125f, -21.000000f, 9.640625f, 5.597656f, 6.578125f, 11.664062f, 5.171875f, 10.531250f, -5.167969f, 5.167969f, -6.925781f, -1.409180f, 13.937500f, 11.632812f, -10.062500f, 2.634766f, -8.054688f, 17.484375f, -5.949219f, 8.984375f, 3.773438f, -2.812500f, -7.824219f, 3.425781f, 7.273438f, 15.015625f, 9.593750f, -4.394531f, -3.253906f, -21.718750f, 4.109375f, 3.130859f, 2.628906f, -6.808594f, -16.062500f, 6.171875f, 6.871094f, 2.097656f, 19.921875f, -4.304688f, 4.343750f, -10.062500f, 9.835938f, -3.902344f, 14.492188f, 6.296875f, -3.097656f, 15.226562f, -2.404297f, 0.917969f, 5.675781f, 5.394531f, -2.919922f, -3.923828f, -15.015625f, -11.453125f, 12.460938f, -5.726562f, -9.328125f, 0.348389f, 4.160156f, -5.011719f, -6.015625f, -13.578125f, -6.199219f, 0.405273f, 9.984375f, -1.296875f, 7.261719f, -12.593750f, -5.363281f, -8.453125f, -11.710938f, -6.285156f, -12.695312f, 2.912109f, -16.078125f, 7.144531f, 10.164062f, 5.515625f, 21.390625f, -16.062500f, -8.226562f, -13.476562f, -14.968750f, 26.078125f, 11.890625f, -12.906250f, 18.140625f, 3.310547f, -21.109375f, -1.125977f, 10.007812f, -2.330078f, 23.781250f, -3.802734f, 0.410156f, -30.218750f, 3.349609f, -3.091797f, 3.078125f, -16.859375f, -4.878906f, -10.148438f, -3.800781f, -6.925781f, 31.296875f, 24.656250f, -8.304688f, 0.892578f, 5.140625f, 9.578125f, -0.250244f, -15.445312f, 0.578125f, -1.429688f, -11.468750f, 18.234375f, -5.542969f, -17.687500f, 4.300781f, -11.195312f, 10.625000f, -1.443359f, -0.548340f, 2.328125f, -1.599609f, -2.935547f, 11.367188f, 6.554688f, 16.765625f, 4.507812f, 2.878906f, -22.390625f, 1.195312f, -1.779297f, -20.250000f, 19.406250f, -2.880859f, 6.632812f, -17.000000f, 12.546875f, -3.007812f, -3.748047f, -4.347656f, -6.894531f, -11.203125f, -0.281494f, -13.070312f, 8.468750f, 18.437500f, -22.421875f, 12.750000f, 13.984375f, 10.375000f, 4.082031f, 18.546875f, 5.289062f, -2.878906f, -9.273438f, 15.007812f, -20.031250f, 4.261719f, -10.789062f, 6.730469f, -14.562500f, -1.368164f, -8.585938f, -10.179688f, 12.312500f, -3.388672f, 1.082031f, 12.359375f, -5.718750f, 3.824219f, -0.758301f, 15.062500f, 2.693359f, -12.273438f, 7.386719f, -17.625000f, -1.206055f, 9.000000f, -1.870117f, 2.822266f, 4.699219f, 11.148438f, 5.207031f, -8.546875f, 10.882812f, -7.460938f, 12.164062f, -0.763672f, 3.191406f, 3.195312f, 1.099609f, -10.781250f, -6.855469f, -3.833984f, 17.921875f, 6.191406f, 3.541016f, -12.500000f, -14.085938f, -5.710938f, 2.511719f, 14.851562f, 5.738281f, -0.362305f, 1.852539f, 9.421875f, 5.753906f, 14.625000f, -22.250000f, -3.306641f, -24.406250f, 2.023438f, -6.074219f, -0.008224f, -8.414062f, 3.396484f, 4.070312f, -0.928223f, 0.539062f, -14.398438f, -3.154297f, -1.222656f, 16.750000f, -1.496094f, 5.625000f, 9.757812f, 4.773438f, -2.812500f, 7.226562f, 1.958984f, -7.371094f, -3.460938f, -17.562500f, 16.296875f, 6.898438f, -8.296875f, -2.494141f, -10.710938f, 16.187500f, -7.796875f, -9.234375f, 11.773438f, 3.273438f, 10.578125f, 1.082031f, 10.656250f, 0.808594f, 0.022354f, 14.929688f, -5.738281f, 4.617188f, -6.832031f, 10.382812f, -9.507812f, -7.585938f, -3.958984f, -0.890625f, 6.242188f, -12.726562f, 20.171875f, 16.468750f, -5.222656f, 1.040039f, -1.831055f, -4.117188f, 4.988281f, 11.734375f, 17.750000f, -9.164062f, -8.945312f, 7.234375f, 16.828125f, 3.572266f, -10.257812f, 1.791992f, 4.820312f, -1.999023f, -1.303711f, 2.408203f, -6.343750f, 7.277344f, -26.234375f, -13.414062f, 4.933594f, -2.771484f, 19.890625f, 10.968750f, -2.109375f, -10.375000f, 1.605469f, -16.828125f, -1.062500f, 2.210938f, -8.414062f, -10.195312f, 3.179688f, 7.324219f, 9.679688f, -9.414062f, 11.234375f, 14.554688f, -0.486816f, -9.531250f, 10.179688f, -2.160156f, -1.119141f, 8.007812f, -16.812500f, 0.406738f, -16.281250f, 13.171875f, -11.468750f, -8.078125f, 20.125000f, 0.630859f, 0.912109f, -3.695312f, -0.964844f, 5.484375f, 1.816406f, -12.351562f, 5.242188f, 3.457031f, 3.759766f, -7.687500f, 9.390625f, 3.554688f, 10.460938f, 14.523438f, 1.813477f, 6.027344f, 14.171875f, -6.828125f, 6.503906f, 18.671875f, 3.759766f, 3.320312f, -3.156250f, 4.800781f, -5.523438f, 4.839844f, -16.343750f, 19.218750f, -3.429688f, -9.921875f, -9.796875f, 4.585938f, 4.156250f, 7.460938f, 3.607422f, 17.437500f, -1.125000f, -17.328125f, -12.671875f, 9.625000f, -19.671875f, 1.270508f, 8.875000f, -6.550781f, -3.000000f, -9.718750f, 19.859375f, 8.101562f, 3.701172f, -12.859375f, -7.625000f, 9.515625f, -20.656250f, 10.281250f, 8.398438f, -2.662109f, -5.613281f, 7.207031f, -11.625000f, -4.617188f, 11.609375f, -7.238281f, 5.796875f, 4.867188f, 3.601562f, 5.011719f, 4.847656f, 16.687500f, 4.839844f, -0.902832f, -8.070312f, -13.046875f, 4.707031f, 15.054688f, 5.445312f, 3.304688f, -12.484375f, -0.558594f, -2.917969f, 13.140625f, 11.906250f, 1.407227f, -9.750000f, -2.888672f, 15.039062f, -0.389893f, 16.187500f, -0.348389f, 1.447266f, -21.140625f, 5.058594f, 12.875000f, -19.968750f, -0.904785f, 1.042969f, 9.328125f, -1.541016f, -10.000000f, 20.968750f, 8.437500f, -10.945312f, 0.778809f, 8.046875f, -16.375000f, -2.007812f, -14.507812f, 2.732422f, 3.521484f, -5.636719f, 24.984375f, -12.765625f, 2.916016f, 8.125000f, -4.109375f, 8.960938f, 0.900879f, -16.187500f, 6.199219f, -0.394287f, -1.849609f, -1.206055f, -3.244141f, 10.281250f, 9.156250f, 7.785156f, 1.040039f, -8.164062f, 1.750977f, -14.054688f, -10.960938f, -22.828125f, 2.654297f, 1.677734f, -1.385742f, 3.074219f, 15.796875f, 17.203125f, -2.501953f, 4.023438f, 7.714844f, -6.527344f, 5.570312f, 1.583984f, -12.351562f, 9.296875f, -1.274414f, 1.003906f, -1.606445f, -7.363281f, -17.593750f, -7.316406f, 10.851562f, -11.937500f, 5.820312f, -6.382812f, -15.960938f, 12.226562f, 0.604004f, 0.601074f, 4.742188f, 11.500000f, 5.792969f, 10.000000f, -9.445312f, -3.517578f, -4.039062f, 1.384766f, -9.804688f, -7.222656f, -3.376953f, 13.851562f, -5.226562f, -1.320312f, 11.500000f, -0.049835f, -21.234375f, -1.339844f, -6.324219f, 4.054688f, -2.345703f, -8.382812f, 1.623047f, -20.062500f, 0.097229f, -8.476562f, -4.218750f, 19.593750f, -2.728516f, -4.207031f, -7.218750f, -3.150391f, 9.140625f, 10.867188f, -12.484375f, 12.031250f, 7.187500f, 5.289062f, 11.945312f, 3.921875f, 11.421875f, 7.027344f, -12.750000f, 12.898438f, 18.359375f, -7.242188f, -9.421875f, -9.671875f, -4.882812f, -3.970703f, -9.945312f, 6.207031f, -7.222656f, -4.781250f, -11.460938f, -2.261719f, 13.492188f, 5.968750f, -3.279297f, -8.804688f, -14.929688f, 9.906250f, -8.429688f, 3.837891f, -4.816406f, -3.964844f, 6.132812f, 19.875000f, 5.039062f, -0.617676f, 9.929688f, -0.126587f, 6.714844f, 11.539062f, 4.925781f, 7.730469f, 10.414062f, -12.742188f, -8.460938f, -0.374268f, -1.544922f, -9.085938f, -4.597656f, 9.914062f, 7.847656f, 2.966797f, 13.609375f, 17.015625f, 5.953125f, -1.748047f, -4.453125f, 8.265625f, 9.093750f, -7.921875f, 26.828125f, 9.312500f, -10.742188f, 25.671875f, -2.867188f, -21.593750f, -14.445312f, 0.218750f, -1.667969f, 4.425781f, 11.492188f, -1.258789f, -9.617188f, -10.359375f, 0.895020f, 4.660156f, 17.968750f, -1.890625f, -3.224609f, 0.218140f, 3.183594f, 2.398438f, -2.939453f, 8.843750f, -6.546875f, 5.000000f, 3.207031f, 1.528320f, -17.343750f, 1.593750f, -3.007812f, 8.093750f, -2.490234f, -11.203125f, -3.878906f, 2.400391f, 20.031250f, -3.388672f, -14.789062f, 0.083008f, -14.851562f, -10.539062f, 6.726562f, 9.406250f, -3.121094f, 6.945312f, 19.781250f, -5.386719f, 1.784180f, 3.916016f, 0.955078f, -1.461914f, 6.863281f, -1.799805f, -8.054688f, 0.048492f, 4.062500f, -12.351562f, 11.546875f, 8.148438f, 13.578125f, -7.906250f, 7.753906f, -0.098938f, -8.984375f, -3.148438f, -11.789062f, 13.015625f, -18.375000f }; +static const float16 expected[] = { 7.527344f, 4.726562f, 2.126953f, 3.083984f, -6.585938f, 16.734375f, 12.390625f, 9.773438f, -9.421875f, 2.328125f, 11.960938f, 19.000000f, 0.446289f, -19.796875f, -2.322266f, -18.406250f, 6.281250f, -8.773438f, -13.828125f, -2.273438f, -7.570312f, -4.644531f, -5.777344f, 7.148438f, -0.109375f, -22.000000f, -1.882812f, 12.195312f, 17.546875f, 6.011719f, 6.710938f, -16.828125f, 5.730469f, 23.781250f, -16.531250f, 29.140625f, 9.812500f, -25.843750f, -21.906250f, -20.671875f, 8.437500f, -24.546875f, -9.406250f, 6.640625f, -12.796875f, -12.773438f, 7.328125f, 17.609375f, -1.396484f, 9.593750f, -6.187500f, 13.140625f, -0.972656f, -14.812500f, 14.343750f, 0.118652f, -33.781250f, 11.265625f, 17.515625f, -4.273438f, 6.570312f, -12.101562f, 10.859375f, 20.468750f, 6.843750f, 9.703125f, -11.992188f, 16.828125f, 5.984375f, 0.349609f, -1.218750f, 2.125000f, -7.746094f, 2.269531f, 8.093750f, 8.218750f, 12.992188f, 2.546875f, -6.109375f, 5.390625f, 13.718750f, -6.046875f, 6.714844f, -12.750000f, 9.992188f, 5.695312f, -2.093750f, 25.250000f, 8.179688f, 0.808594f, 2.781250f, -23.937500f, -17.468750f, 13.531250f, 16.062500f, -13.125000f, -24.375000f, -5.351562f, -8.539062f, -3.148438f, -7.929688f, 23.468750f, 6.941406f, 8.984375f, -6.648438f, -14.765625f, 25.703125f, -11.171875f, 9.125000f, -53.812500f, -10.531250f, 14.492188f, -26.859375f, 14.101562f, 9.031250f, -4.031250f, -3.492188f, -42.812500f, 11.093750f, -0.476562f, 11.015625f, 19.156250f, 8.375000f, 18.000000f, -16.953125f, 6.003906f, -2.214844f, 23.093750f, -31.562500f, -16.906250f, -18.359375f, -10.335938f, -5.242188f, -26.218750f, 15.148438f, 1.300781f, 9.625000f, 0.657715f, -16.718750f, -19.125000f, -2.451172f, -3.882812f, 21.781250f, -3.398438f, 4.394531f, -5.859375f, 8.828125f, 7.113281f, 6.980469f, 0.492188f, -18.906250f, 0.421875f, -23.343750f, -13.718750f, -6.187500f, -7.089844f, -7.281250f, 31.187500f, -6.718750f, -7.132812f, -11.828125f, -41.250000f, -22.812500f, 6.273438f, 1.859375f, -0.078125f, 23.906250f, 22.140625f, 0.349609f, -1.007812f, 20.765625f, 12.164062f, 1.781250f, 3.242188f, 31.546875f, -8.656250f, -13.203125f, -9.304688f, 5.640625f, -23.531250f, -11.796875f, 25.875000f, -5.664062f, 4.355469f, 35.500000f, -4.574219f, 26.218750f, 15.187500f, 21.906250f, -4.238281f, -22.625000f, -3.980469f, -13.328125f, -2.500000f, -19.500000f, 8.539062f, 18.421875f, -1.951172f, 7.210938f, -2.652344f, -16.750000f, -0.841797f, -34.125000f, 2.232422f, -5.980469f, -3.775391f, -7.226562f, 7.984375f, 5.804688f, -11.078125f, 0.507812f, 6.992188f, -5.054688f, -5.238281f, -12.773438f, 24.578125f, -6.511719f, 22.468750f, 5.492188f, 21.859375f, 10.421875f, -3.730469f, -18.656250f, 3.054688f, 22.562500f, 13.070312f, -0.611328f, -18.296875f, -0.910156f, 2.578125f, -17.562500f, 13.765625f, -15.679688f, 16.343750f, -8.171875f, -13.953125f, 9.648438f, 28.031250f, 15.640625f, 2.152344f, 0.819336f, -13.210938f, 9.468750f, 1.443359f, -1.378906f, -7.183594f, 22.140625f, 31.359375f, -30.031250f, -11.453125f, 29.531250f, -6.902344f, 1.859375f, -12.046875f, 15.500000f, 25.031250f, 17.750000f, 10.781250f, 16.062500f, -8.953125f, -5.699219f, 6.023438f, 11.515625f, -6.273438f, 6.476562f, -7.281250f, 9.992188f, -12.382812f, -27.203125f, 3.472656f, 11.031250f, -4.500000f, 7.593750f, -0.962891f, -0.994141f, -10.828125f, 5.890625f, 7.332031f, -11.023438f, 0.344727f, 1.730469f, -22.875000f, 8.015625f, 8.718750f, 29.156250f, -1.394531f, -6.566406f, 22.593750f, -1.117188f, 14.125000f, -17.578125f, -14.945312f, -8.250000f, -10.921875f, 2.765625f, 6.894531f, -6.902344f, 1.644531f, -6.234375f, -10.398438f, 21.750000f, -12.046875f, -10.937500f, -19.562500f, 13.859375f, 3.501953f, 34.875000f, -8.148438f, -3.759766f, 6.613281f, -17.390625f, 5.484375f, -9.906250f, -12.289062f, 15.750000f, -9.750000f, -3.812500f, -9.554688f, -4.671875f, 22.562500f, -8.015625f, 6.769531f, 3.312500f, -16.218750f, 12.921875f, 2.214844f, -11.984375f, -12.429688f, -20.234375f, -13.250000f, 26.890625f, -12.203125f, -17.437500f, 19.765625f, -11.890625f, -17.890625f, -19.109375f, 13.476562f, 1.386719f, 2.632812f, 14.453125f, -5.851562f, 11.335938f, -7.066406f, 2.535156f, -10.609375f, 20.140625f, 4.230469f, 15.257812f, 22.265625f, -8.546875f, -13.734375f, -16.500000f, -0.531250f, -5.265625f, -13.289062f, -7.000000f, 14.953125f, -6.402344f, 0.703125f, 4.960938f, -4.171875f, -1.750000f, 10.210938f, -4.945312f, 28.765625f, 4.304688f, -2.011719f, 17.140625f, 20.640625f, -23.250000f, -16.687500f, -5.601562f, -19.500000f, 32.156250f, -1.828125f, -14.031250f, 17.500000f, 7.679688f, 2.722656f, 21.125000f, -7.691406f, 6.117188f, 6.648438f, -3.978516f, 20.000000f, 7.597656f, -7.101562f, 3.757812f, -14.968750f, -15.312500f, -5.500000f, 17.375000f, 6.789062f, -4.828125f, -4.449219f, 19.953125f, 6.316406f, -10.882812f, 10.460938f, 16.453125f, -23.625000f, -1.710938f, -10.421875f, 3.777344f, -14.570312f, 5.109375f, 10.312500f, -17.343750f, -24.046875f, -3.869141f, -9.468750f, 12.968750f, 5.867188f, 8.296875f, -5.132812f, 19.500000f, -3.320312f, -1.734375f, 5.535156f, -13.890625f, -7.265625f, -1.847656f, 0.904297f, -26.968750f, 9.187500f, -9.023438f, 21.031250f, -11.390625f, 17.453125f, 8.281250f, -23.031250f, -1.589844f, 17.062500f, 0.271973f, -0.605469f, 25.781250f, -4.632812f, 4.242188f, -4.632812f, -20.984375f, -8.445312f, 2.234375f, 5.289062f, 16.640625f, -15.195312f, 11.921875f, -0.250000f, -21.031250f, -11.992188f, -3.058594f, 5.347656f, -21.671875f, 14.242188f, 17.531250f, 18.453125f, -12.242188f, -15.710938f, -2.511719f, 6.781250f, 21.343750f, -4.152344f, -2.121094f, -1.903320f, -6.683594f, -3.226562f, -1.373047f, 18.078125f, -17.562500f, -7.765625f, -2.451172f, -28.468750f, 2.662109f, 4.414062f, 38.937500f, 4.007812f, 11.843750f, 6.964844f, -13.914062f, -6.492188f, -22.562500f, 21.000000f, 34.406250f, -1.804688f, 3.023438f, -4.289062f, 8.484375f, -33.593750f, -7.312500f, -13.875000f, 21.937500f, 4.714844f, 20.828125f, -1.466797f, 7.437500f, -3.005859f, 6.753906f, -20.890625f, -5.449219f, -0.765625f, 1.304688f, -10.773438f, 11.125000f, -22.296875f, 18.875000f, -17.437500f, -5.179688f, -0.199219f, 2.314453f, -8.789062f, 6.738281f, 3.382812f, 34.937500f, 10.750000f, 1.945312f, 16.875000f, -2.386719f, -17.890625f, 3.318359f, -7.136719f, 13.890625f, -28.218750f, 14.546875f, 1.810547f, -7.203125f, 4.878906f, 17.343750f, -9.179688f, -13.265625f, 22.140625f, 19.437500f, -0.519531f, 5.539062f, -9.476562f, -11.578125f, -2.978516f, 5.265625f, -5.718750f, -10.984375f, 14.523438f, -15.992188f, -4.562500f, 12.468750f, 9.804688f, -1.332031f, 12.210938f, -8.500000f, -21.875000f, -1.931641f, 7.007812f, 0.328125f, 1.093750f, -8.406250f, -15.789062f, -3.414062f, -12.648438f, 18.859375f, 9.703125f, 1.964844f, 6.027344f, 4.597656f, 17.984375f, 1.464844f, 15.562500f, 8.796875f, -22.781250f, 17.562500f, -6.152344f, 2.460938f, 9.625000f, -4.640625f, -4.523438f, 11.140625f, -5.746094f, 8.625000f, -15.140625f, -19.687500f, 9.687500f, 3.066406f, -13.375000f, -8.351562f, 10.921875f, 14.109375f, -20.093750f, -10.953125f, -4.679688f, -3.779297f, 5.238281f, -1.589844f, -1.830078f, -20.156250f, 27.218750f, 0.089844f, 4.824219f, -10.398438f, -17.343750f, -3.851562f, 2.343750f, 5.488281f, -7.480469f, 25.281250f, 2.390625f, 12.171875f, -6.437500f, 1.402344f, -11.156250f, -1.605469f, -4.109375f, 9.273438f, -25.093750f, -17.250000f, -11.226562f, -8.218750f, 4.601562f, 16.281250f, -15.218750f, 5.933594f, 5.609375f, -6.312500f, 1.609375f, -7.546875f, 2.513672f, 1.718750f, 12.031250f, -20.343750f, -12.226562f, -0.390625f, -6.812500f, 8.656250f, -11.484375f, -9.218750f, 8.210938f, 2.234375f, -8.531250f, 5.261719f, 12.765625f, -4.359375f, -18.234375f, -17.328125f, -25.750000f, 4.992188f, 14.281250f, 16.625000f, -12.507812f, 30.812500f, 7.511719f, -15.281250f, -10.109375f, 4.109375f, -24.562500f, 8.328125f, 30.656250f, 15.812500f, 4.187500f, 1.904297f, 18.375000f, -11.914062f, 8.109375f, 15.281250f, -9.828125f, -1.222656f, -13.953125f, -4.492188f, -12.617188f, -6.332031f, -17.812500f, 16.718750f, 24.781250f, -21.953125f, 1.582031f, 10.148438f, 3.080078f, 6.402344f, -13.523438f, 8.718750f, -10.812500f, -2.808594f, 4.101562f, 1.066406f, -7.613281f, -12.890625f, -18.312500f, -4.871094f, 7.714844f, -3.925781f, 22.859375f, 12.757812f, -14.484375f, -5.148438f, -20.296875f, 13.210938f, 12.890625f, 25.156250f, 21.750000f, 32.062500f, 15.453125f, 18.968750f, 7.937500f, -0.609375f, -9.765625f, 31.406250f, 10.031250f, 6.164062f, -3.636719f, 13.109375f, -27.437500f, 13.562500f, 11.546875f, -20.531250f, 1.377930f, -4.167969f, 19.250000f, 0.128906f, 6.984375f, 12.078125f, -4.296875f, -10.218750f, 6.160156f, -1.609375f, -6.796875f, 5.402344f, -0.710938f, 19.093750f, -8.718750f, -16.984375f, 0.750000f, -34.093750f, 6.929688f, -30.625000f, 9.453125f, -29.140625f, -5.406250f, 9.289062f, -11.046875f, 5.816406f, -13.609375f, -3.943359f, -9.070312f, 37.937500f, 1.945312f, -9.390625f, 13.429688f, -15.453125f, -2.273438f, 0.648438f, -8.796875f, -6.339844f, -17.093750f, 11.210938f, -16.437500f, -13.375000f, -2.203125f, -4.886719f, 15.046875f, -1.949219f, -5.437500f, 1.656250f, 4.656250f, -7.277344f, -4.546875f, 5.187500f, -9.593750f, -6.113281f, -23.671875f, -0.146973f, -13.140625f, -17.156250f, -17.421875f, -23.843750f, -9.679688f, -17.468750f, 2.287109f, -3.171875f, -9.648438f, 20.781250f, -3.394531f, 5.171875f, -44.000000f, 3.121094f, -4.593750f, 5.562500f, -6.785156f, 11.296875f, 11.468750f, -1.898438f, -17.203125f, -7.007812f, -22.031250f, -20.593750f, 3.164062f, 13.953125f, 4.914062f, 4.519531f, 15.140625f, -7.886719f, -9.023438f, -13.625000f, -9.750000f, -19.687500f, 3.730469f, -24.250000f, 0.175781f, -9.460938f, 12.375000f, 3.562500f, -5.019531f, -15.429688f, 15.804688f, 5.441406f, 2.195312f, -4.835938f, -1.250000f, 1.727539f, -47.562500f, -11.437500f, 16.140625f, -24.093750f, -10.453125f, -9.859375f, 28.500000f, -19.578125f, -4.332031f, -6.320312f, 9.031250f, 6.308594f, 4.984375f, -5.886719f, -15.179688f, 26.718750f, 18.625000f, 17.187500f, -11.359375f, 14.453125f, 15.328125f, 2.519531f, 7.617188f, 11.328125f, -6.832031f, 1.128906f, -3.039062f, -12.773438f, 2.777344f, -11.875000f, -27.343750f, 7.101562f, 20.359375f, -9.703125f, 20.718750f, 4.316406f, -14.218750f, 1.390625f, 25.484375f, 19.781250f, 14.335938f, -6.742188f, -7.476562f, 8.773438f, -7.824219f, 7.574219f, -10.812500f, -16.125000f, -21.937500f, -7.820312f, -2.130859f, 8.617188f, 4.464844f, 7.679688f, -15.234375f, 5.023438f, 0.058594f, -9.492188f, 3.390625f, 4.867188f, -15.601562f, -10.156250f, 4.195312f, 13.460938f, 9.609375f, -33.093750f, -3.789062f, 12.031250f, -9.429688f, -15.421875f, -15.156250f, -2.250000f, 15.976562f, 0.785156f, 11.398438f, 7.261719f, -2.595703f, 15.328125f, -32.625000f, -14.382812f, 20.843750f, -0.351562f, 14.632812f, -0.238281f, 18.375000f, -4.125000f, -28.468750f, 2.968750f, -13.156250f, -31.968750f, 26.218750f, 28.343750f, -6.664062f, -20.281250f, -2.992188f, 1.328125f, -23.078125f, 9.882812f, 11.789062f, 22.375000f, 7.695312f, -12.281250f, 4.875000f, 8.945312f, 25.875000f, -7.632812f, -12.609375f, -10.953125f, 12.226562f, 5.714844f, 4.515625f, 22.375000f, -18.562500f, 15.648438f, -2.878906f, -19.421875f, -3.978516f, -11.023438f, -7.363281f, -14.968750f, 6.640625f, -26.468750f, 2.660156f, -17.703125f, -3.382812f, -12.546875f, 12.460938f, 8.570312f, 6.488281f, 5.480469f, -14.406250f, -18.093750f, -15.101562f, -0.876953f, -2.632812f, 1.765625f, -4.187500f, -0.742188f, 9.343750f, 8.179688f, -3.560547f, 20.937500f, 6.703125f, 22.093750f, 15.492188f, 22.031250f, 3.214844f, -13.515625f, -19.671875f, 8.390625f, 7.406250f, 20.578125f, -3.625000f, -12.335938f, 3.023438f, -25.343750f, -21.718750f, -2.761719f, -9.828125f, 20.593750f, -10.257812f, -2.289062f, 6.164062f, -13.093750f, 4.886719f, -8.148438f, 7.179688f, -6.699219f, -9.437500f, -26.906250f, -4.515625f, -14.335938f, -22.546875f, -20.906250f, 6.792969f, -0.900391f, 9.015625f, 17.156250f, -20.593750f, -4.914062f, 41.531250f, 3.750000f, 22.921875f, 4.429688f, 7.847656f, 9.312500f, -4.593750f, -2.648438f, -2.789062f, -10.125000f, -11.757812f, -21.625000f, 18.656250f, -31.421875f, 4.835938f, 7.800781f, 7.781250f, -12.085938f, 11.812500f, -22.562500f, -7.863281f, 15.351562f, 8.437500f, -19.375000f, 16.421875f, 6.125000f, 21.687500f, 6.957031f, -3.652344f, 3.351562f, -17.593750f, -19.890625f, 20.875000f, -23.921875f, -7.156250f, -12.507812f, 15.414062f, 23.625000f, -5.242188f, -12.703125f, 6.156250f, 5.460938f, 1.125977f, 7.125000f, -16.156250f, 6.929688f, 10.484375f, -4.492188f, -5.289062f, -5.875000f, 7.214844f, 7.562500f, 7.324219f, 9.453125f, -17.156250f, 6.265625f, 12.593750f, 10.484375f, -10.171875f, 3.306641f, 10.328125f, 7.070312f, -11.859375f, 2.560547f, -4.820312f, -18.250000f, 7.679688f, 15.585938f, 11.773438f, 23.437500f, -8.523438f, 2.781250f, -23.375000f, 18.390625f, 11.687500f, 6.601562f, 2.757812f, 10.773438f, -11.390625f, -13.156250f, -14.281250f, 1.554688f, -5.984375f, 27.156250f, -8.875000f, 12.398438f, -12.109375f, 23.656250f, 4.828125f, 7.718750f, -18.187500f, 15.203125f, -22.796875f, 11.250000f, -24.343750f, -9.218750f, -3.195312f, 7.488281f, 24.500000f, -9.335938f, 18.781250f, 1.132812f, 20.093750f, -13.843750f, -15.593750f, 22.703125f, 25.093750f, -26.625000f, -24.375000f, -11.718750f, -4.191406f, 1.676758f, -4.109375f, -3.398438f, -12.984375f, 10.500000f, 13.921875f, -27.546875f, -26.156250f, -14.960938f, -9.257812f, -31.781250f, -41.875000f, -1.750000f, 5.949219f, -19.437500f, -0.667969f, 2.070312f, -14.453125f, 21.718750f, 6.687500f, 12.906250f, 13.421875f, -9.156250f, 8.070312f, 9.843750f, -8.250000f, -9.710938f, -13.234375f, 2.441406f, 29.875000f, 3.734375f, 6.914062f, 13.375000f, -26.375000f, 35.812500f, 9.578125f, -0.813965f, 15.984375f, 3.011719f, 16.656250f, 43.906250f, 3.738281f, 11.171875f, -1.574219f, -3.779297f, 16.812500f, 17.281250f, -5.812500f, -14.960938f, -0.590820f, 7.476562f, 18.046875f, -16.437500f, 15.625000f, 16.234375f, -4.570312f, -9.015625f, 12.757812f, -5.285156f, -15.265625f, 24.531250f, -11.328125f, -7.234375f, 11.304688f, 27.453125f, 0.003906f, -0.181641f, 7.484375f, 14.570312f, 2.576172f, -11.070312f, 3.261719f, -11.375000f, -6.425781f, 0.730469f, 1.804688f, -29.609375f, 25.406250f, 0.685547f, -3.457031f, -12.343750f, -17.031250f, 10.804688f, 8.390625f, 0.363770f, -2.277344f, -2.792969f, 32.468750f, 11.695312f, 6.695312f, -10.070312f, 18.937500f, 8.046875f, -18.421875f, 26.640625f, 3.562500f, 7.726562f, 12.882812f, -6.023438f, 14.968750f, 18.500000f, -23.796875f, 0.593750f, 21.531250f, -33.125000f, 15.000000f, 4.945312f, -6.707031f, 18.328125f, 1.902344f, -1.439453f, -10.226562f, -5.734375f, 16.531250f, 21.562500f, -9.984375f, 10.507812f, -4.265625f, -14.742188f, -9.710938f, 2.285156f, -10.929688f, -2.687500f, -29.593750f, 6.507812f, 4.164062f, 7.226562f, 14.718750f, -14.890625f, -1.921875f, -7.531250f, -6.675781f, 11.875000f, 1.542969f, -31.250000f, -14.484375f, -9.070312f, -11.226562f, 14.218750f, 6.859375f, -8.234375f, 27.718750f, 21.031250f, 10.429688f, 4.425781f, 9.437500f, 20.625000f, -5.539062f, -7.003906f, 15.593750f, 11.250000f, -3.250000f, -10.515625f, 10.046875f, -21.531250f, -18.984375f, 10.156250f, 10.023438f, 17.046875f, 10.273438f, -18.390625f, -11.250000f, -23.078125f, -19.625000f, -10.523438f, -28.453125f, 12.367188f, 17.843750f, -8.484375f, -19.828125f, -5.695312f, -8.835938f, -8.679688f, 0.187500f, 0.882812f, 11.820312f, 20.656250f, -17.125000f, -6.132812f, -0.085938f, -15.125000f, -3.101562f, -22.859375f, -6.628906f, 1.041016f, 23.078125f, -20.656250f, -16.593750f, 5.339844f, -1.136719f, -4.046875f, 3.927734f, -7.980469f, 7.546875f, -14.757812f, 5.246094f, -20.625000f, -5.308594f, -2.882812f, -0.539062f, -19.859375f, -4.707031f, 0.445312f, 4.335938f, 19.562500f, 7.675781f, -7.054688f, -12.757812f, -16.468750f, -18.531250f, 17.656250f, -3.580078f, -0.680664f, 12.093750f, 18.484375f, -13.437500f, 33.375000f, 0.429688f, -18.812500f, 42.750000f, 5.054688f, -1.609375f, -18.093750f, -2.625000f, 20.031250f, 29.859375f, 0.807617f, 19.953125f, 6.277344f, 0.660156f, 7.210938f, -6.695312f, 29.796875f, -7.695312f, -15.929688f, 20.312500f, -0.093750f, 11.000000f, 12.906250f, -17.015625f, -6.097656f, -22.734375f, 12.593750f, -10.484375f, 5.683594f, -12.265625f, 10.335938f, 23.562500f, 2.462891f, -31.312500f, 15.656250f, -15.484375f, -2.652344f, 11.562500f, 1.804688f, -7.855469f, -6.132812f, 4.796875f, -18.656250f, 4.117188f, -2.015625f, 30.687500f, -0.105469f, 27.312500f, -11.335938f, -2.429688f, 10.023438f, -22.328125f, 9.703125f, 6.960938f, -1.568359f, -24.968750f, -0.080078f, 2.738281f, 16.515625f, 3.257812f, -5.312500f, 7.937500f, 8.625000f, 23.281250f, -21.890625f, -3.988281f, 15.578125f, -1.515625f, -4.363281f, 2.601562f, 9.359375f, -1.267578f, 8.609375f, -2.376953f, -27.328125f, 4.085938f, 32.125000f, -2.035156f, -21.671875f, -10.234375f, -12.953125f, 6.320312f, -23.562500f, 25.656250f, 29.000000f, -3.523438f, -3.164062f, -22.593750f, 21.578125f, 19.562500f, 10.914062f, 11.554688f, -1.558594f, -3.289062f, -4.070312f, -4.785156f, 1.683594f, -15.023438f, 10.007812f, 1.859375f, 7.812500f, 7.484375f, 10.414062f, 30.875000f, -16.968750f, 19.687500f, 10.601562f, -10.015625f, 14.671875f, 3.554688f, 13.000000f, 5.757812f, -19.734375f, -25.984375f, 6.207031f, -27.437500f, -4.218750f, 7.835938f, 13.656250f, 12.328125f, -21.984375f, 2.007812f, 21.218750f, -7.441406f, 12.820312f, -9.687500f, -2.687500f, -0.304688f, -3.390625f, -7.429688f, 24.500000f, -6.179688f, -1.363281f, 16.828125f, 2.927734f, -3.023438f, 9.250000f, 4.492188f, 9.914062f, 18.937500f, -25.796875f, -1.164062f, -1.531250f, -3.294922f, -9.234375f, 8.351562f, -32.218750f, -2.513672f, -12.750000f, -16.859375f, -9.015625f, 19.968750f, 3.968750f, 0.195312f, 9.070312f, 7.656250f, 7.980469f, -10.781250f, 3.937500f, -10.015625f, -26.187500f, 5.378906f, -25.546875f, 8.132812f, 2.480469f, 5.382812f, 22.234375f, -11.421875f, -18.250000f, 3.679688f, -16.234375f, 22.250000f, 18.312500f, -7.367188f, 29.843750f, -10.804688f, -24.734375f, 1.456055f, 12.265625f, -2.953125f, 30.015625f, -1.232422f, 6.652344f, -37.156250f, 9.296875f, -22.078125f, 2.361328f, -28.656250f, 6.550781f, -8.695312f, -19.984375f, -15.359375f, 30.218750f, 15.835938f, 1.640625f, 1.298828f, -3.867188f, -7.687500f, -20.234375f, -6.414062f, 25.578125f, 6.718750f, -5.320312f, 1.171875f, -15.906250f, -15.523438f, -7.503906f, -12.375000f, 1.992188f, -1.740234f, -6.585938f, 0.544922f, 8.109375f, 3.748047f, 17.234375f, 9.078125f, 40.937500f, -4.179688f, -12.453125f, -30.953125f, 0.696289f, -2.568359f, -26.203125f, 22.937500f, -11.226562f, 2.347656f, -9.062500f, 23.281250f, 6.375000f, -28.140625f, 0.019531f, -20.703125f, -18.281250f, -8.812500f, -20.187500f, 3.273438f, 39.093750f, -27.703125f, 4.250000f, -3.859375f, 3.085938f, 14.031250f, 10.945312f, 25.062500f, -18.578125f, -19.781250f, 25.593750f, -16.593750f, -8.500000f, -15.562500f, 6.328125f, 8.421875f, -0.828613f, -3.500000f, -15.898438f, -0.531250f, -29.890625f, 0.951172f, -12.296875f, 7.632812f, -17.656250f, 9.726562f, 28.171875f, 7.601562f, -21.843750f, 4.953125f, -29.765625f, -3.855469f, 21.906250f, 4.140625f, -3.904297f, 18.500000f, -14.898438f, -11.421875f, 2.562500f, 11.773438f, -7.851562f, 21.843750f, 17.281250f, 2.351562f, -18.000000f, 4.363281f, -19.500000f, 3.410156f, -8.929688f, 9.953125f, -18.093750f, -18.437500f, -21.437500f, -5.367188f, -18.468750f, 7.230469f, 14.281250f, -3.917969f, 3.769531f, 2.351562f, 8.195312f, -19.312500f, 19.484375f, -9.335938f, 6.101562f, -24.031250f, 0.807617f, 13.468750f, 0.347656f, -3.906250f, -7.820312f, -19.125000f, 24.421875f, -4.765625f, -5.429688f, -18.125000f, -11.859375f, 18.171875f, 2.519531f, 4.144531f, 17.828125f, -15.476562f, 0.359375f, 0.691406f, 5.722656f, 0.214844f, -5.929688f, -32.875000f, 23.750000f, -9.046875f, -1.644531f, 0.246094f, -25.062500f, 4.898438f, -13.875000f, -3.621094f, 12.117188f, -4.789062f, 13.734375f, -8.937500f, 13.484375f, -0.016602f, -11.468750f, 13.507812f, -12.609375f, -6.062500f, -4.945312f, 17.687500f, -17.078125f, -11.835938f, -13.171875f, -7.324219f, 3.058594f, -17.531250f, 23.062500f, 25.781250f, -2.968750f, -7.382812f, 14.578125f, -2.902344f, 13.812500f, 5.140625f, 25.906250f, -0.382812f, -36.812500f, -0.636719f, 40.875000f, 4.453125f, -18.281250f, -19.390625f, 5.046875f, -1.246094f, 3.093750f, 2.865234f, -3.035156f, -7.441406f, -15.953125f, -5.535156f, 12.585938f, -7.031250f, 14.648438f, 19.437500f, -9.187500f, -14.820312f, 10.593750f, 4.546875f, 4.546875f, 5.882812f, -7.515625f, -19.125000f, 12.117188f, 9.515625f, 9.710938f, 3.960938f, 22.515625f, 35.750000f, -19.265625f, -16.593750f, 9.609375f, -1.775391f, 0.779297f, 9.804688f, -17.453125f, -14.726562f, -33.593750f, 12.671875f, -6.324219f, 6.773438f, 20.687500f, 5.164062f, 10.937500f, -24.187500f, 2.314453f, 19.125000f, 15.859375f, -6.015625f, 20.953125f, 8.695312f, 11.789062f, -5.625000f, 8.515625f, 2.654297f, 13.445312f, 12.289062f, 17.406250f, 25.609375f, 14.484375f, -22.484375f, 19.406250f, 41.406250f, 14.281250f, -13.835938f, 11.726562f, 17.515625f, -15.890625f, 19.968750f, -10.062500f, 19.484375f, -3.306641f, -9.125000f, -5.007812f, 18.093750f, -8.000000f, -7.093750f, 10.046875f, 41.031250f, 3.859375f, -12.156250f, -19.515625f, 3.382812f, -7.570312f, -17.343750f, 12.929688f, 0.210938f, -11.281250f, -17.875000f, 25.750000f, 16.968750f, 13.421875f, -16.625000f, -7.511719f, -8.703125f, -14.835938f, 24.406250f, 6.324219f, 0.365234f, 3.332031f, -6.746094f, -6.136719f, -7.523438f, 13.593750f, 1.292969f, 8.257812f, 12.171875f, 4.335938f, 22.796875f, 13.968750f, 2.335938f, 5.964844f, -3.367188f, -3.218750f, -26.500000f, 7.656250f, 6.554688f, 10.484375f, 5.539062f, -14.851562f, -3.347656f, -7.957031f, 12.242188f, 25.093750f, -5.691406f, -32.125000f, 0.250000f, 31.843750f, -6.894531f, -4.437500f, -7.039062f, 21.703125f, -21.828125f, 2.408203f, 12.078125f, -21.265625f, 7.687500f, -0.779297f, 0.757812f, -16.046875f, -22.593750f, 27.562500f, 7.082031f, -5.593750f, -4.425781f, 14.445312f, -11.039062f, 8.500000f, -15.875000f, 1.264648f, -25.000000f, -11.234375f, 36.125000f, -6.667969f, 0.757812f, 9.507812f, -10.546875f, 18.765625f, -9.234375f, -14.554688f, -3.113281f, -19.984375f, -1.567383f, -1.138672f, 11.429688f, -0.296875f, 2.433594f, 13.234375f, -4.878906f, -6.359375f, 0.265625f, -23.171875f, -22.031250f, -11.429688f, 12.406250f, 15.507812f, 3.179688f, 17.671875f, 27.109375f, 20.515625f, -13.281250f, -22.687500f, 6.976562f, -6.078125f, 1.257812f, 8.140625f, -18.828125f, -12.203125f, -3.902344f, 5.777344f, -7.011719f, 7.691406f, -9.382812f, -10.664062f, 14.031250f, -32.125000f, 10.828125f, 3.046875f, -19.109375f, 10.554688f, 27.593750f, 12.648438f, -2.437500f, 23.796875f, 14.140625f, 0.273438f, -13.710938f, 14.859375f, 2.636719f, -5.421875f, -8.289062f, -6.437500f, -7.640625f, -3.351562f, -1.478516f, -12.265625f, 0.445312f, -22.968750f, -21.500000f, -11.781250f, -25.921875f, 17.234375f, -8.351562f, -2.953125f, -7.679688f, -27.812500f, -12.890625f, -21.218750f, -1.308594f, 12.367188f, -8.179688f, -14.328125f, -20.718750f, 16.156250f, 43.875000f, 10.062500f, -18.265625f, 16.437500f, -1.335938f, 4.046875f, 6.089844f, 13.000000f, 31.734375f, 5.886719f, -12.367188f, 6.457031f, 8.820312f, -21.531250f, 1.140625f, -13.921875f, -0.312500f, 1.376953f, -18.093750f, -6.792969f, 2.847656f, -3.933594f, -18.125000f, -2.546875f, 11.296875f, 9.421875f, -8.023438f, -11.890625f, -14.546875f, 8.218750f, -2.937500f, 18.968750f, 8.859375f, -9.218750f, -7.421875f, 25.390625f, 15.820312f, 4.902344f, 12.984375f, 2.277344f, 10.312500f, 14.109375f, 6.382812f, 16.843750f, 0.937500f, -14.585938f, -12.039062f, 11.195312f, -6.625000f, 22.437500f, -11.890625f, 13.468750f, 8.273438f, 14.062500f, 4.281250f, 11.953125f, -1.031250f, -12.218750f, 0.167969f, 7.363281f, 15.531250f, -0.921875f, 19.718750f, 11.554688f, -15.281250f, 31.906250f, -13.070312f, -23.828125f, -11.554688f, -5.839844f, -29.921875f, 21.937500f, 13.054688f, -5.527344f, -10.640625f, 0.281250f, -7.152344f, -2.437500f, 17.437500f, -9.148438f, -6.183594f, 14.562500f, 23.390625f, 4.976562f, -3.000000f, 0.945312f, -23.875000f, -5.250000f, -11.093750f, -19.500000f, -5.125000f, 0.161133f, 2.429688f, 8.734375f, -1.078125f, -8.875000f, -20.593750f, 12.765625f, 12.031250f, -1.864258f, -18.109375f, -18.609375f, -18.781250f, -10.695312f, -2.140625f, 15.296875f, -17.359375f, 0.664062f, 22.500000f, -18.593750f, -5.875000f, 19.500000f, 5.945312f, 9.203125f, -12.796875f, -9.828125f, -9.492188f, -6.980469f, 9.742188f, -13.062500f, 8.250000f, 12.085938f, 21.718750f, -12.234375f, -5.972656f, -4.867188f, -13.390625f, -10.109375f, -39.062500f, 15.296875f, 1.203125f }; + +#endif /* DATA_H_ */ diff --git a/tests/spatz_on_magia/onnx_add/test_data/generator.py b/tests/spatz_on_magia/onnx_add/test_data/generator.py new file mode 100644 index 00000000..9034e927 --- /dev/null +++ b/tests/spatz_on_magia/onnx_add/test_data/generator.py @@ -0,0 +1,76 @@ +import os +import sys +import numpy as np +import onnx +import onnxruntime as ort +from onnx import helper, TensorProto + +def parse_args(): + if len(sys.argv) != 2: + print("Error: missing argument ") + print("Usage: python3 generator.py ") + sys.exit(1) + + try: + length = int(sys.argv[1]) + except ValueError: + print("Error: must be an integer") + print("Usage: python3 generator.py ") + sys.exit(1) + + return length + +def run_onnx_add(vec_a, vec_b): + a_info = helper.make_tensor_value_info('A', TensorProto.FLOAT16, vec_a.shape) + b_info = helper.make_tensor_value_info('B', TensorProto.FLOAT16, vec_b.shape) + out_info = helper.make_tensor_value_info('Sum', TensorProto.FLOAT16, vec_a.shape) + + node_def = helper.make_node('Add', ['A', 'B'], ['Sum']) + graph_def = helper.make_graph( + [node_def], + 'onnx-add-test', + [a_info, b_info], + [out_info] + ) + model_def = helper.make_model(graph_def, producer_name='onnx-generator') + + sess = ort.InferenceSession(model_def.SerializeToString()) + res = sess.run(None, {'A': vec_a, 'B': vec_b}) + + return res[0] + +def format_array(array): + return "{ " + ", ".join(f"{x:f}f" for x in array) + " }" + +def generate_header_file(length, vec_a, vec_b, expected, filename="data.h"): + + script_dir = os.path.dirname(os.path.abspath(__file__)) + filepath = os.path.join(script_dir, filename) + + with open(filepath, "w") as f: + f.write("/* Automatically generated header file for Spatz ONNX testing */\n") + f.write("#ifndef DATA_H_\n") + f.write("#define DATA_H_\n\n") + + f.write(f"#define LEN {length}\n\n") + + f.write(f"static const float16 vec_a[] = {format_array(vec_a)};\n") + f.write(f"static const float16 vec_b[] = {format_array(vec_b)};\n") + f.write(f"static const float16 expected[] = {format_array(expected)};\n\n") + + f.write("#endif /* DATA_H_ */\n") + +def main(): + length = parse_args() + + vec_a = (np.random.randn(length) * 10).astype(np.float16) + vec_b = (np.random.randn(length) * 10).astype(np.float16) + + expected = run_onnx_add(vec_a, vec_b) + + generate_header_file(length, vec_a, vec_b, expected) + + print(f"File 'data.h' successfully generated with {length} elements.") + +if __name__ == "__main__": + main() diff --git a/tests/spatz_on_magia/onnx_clip/CMakeLists.txt b/tests/spatz_on_magia/onnx_clip/CMakeLists.txt new file mode 100644 index 00000000..069cc94e --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/CMakeLists.txt @@ -0,0 +1,20 @@ +set(TEST_NAME onnx_clip) + +# Compile Spatz task +add_spatz_task( + TEST_NAME ${TEST_NAME} + TASK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spatz_task/onnx_clip_task.c + FIRST_TASK_NAME onnx_clip_task + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# Compile CV32 executable with embedded Spatz binary +add_cv32_executable_with_spatz( + TARGET_NAME ${TEST_NAME} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.c + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) diff --git a/tests/spatz_on_magia/onnx_clip/include/onnx_clip_mem_layout.h b/tests/spatz_on_magia/onnx_clip/include/onnx_clip_mem_layout.h new file mode 100644 index 00000000..0bae4e9f --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/include/onnx_clip_mem_layout.h @@ -0,0 +1,34 @@ +#ifndef ONNX_CLIP_MEM_LAYOUT_H_ +#define ONNX_CLIP_MEM_LAYOUT_H_ + +#include "magia_utils.h" +#include "data.h" +#include "onnx_clip_params.h" + +#define ALIGNMENT 4 +/* Aligns the given address to 4-byte */ +#define ALIGN_4B(addr) (((addr) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)) + +#define L1_BASE_TILE (L1_BASE + (get_hartid() * L1_TILE_OFFSET)) +#define VEC_SIZE (LEN * sizeof(float16)) +#define SCALAR_SIZE (sizeof(float16)) + +#define ONNX_CLIP_PARAMS_BASE L1_BASE_TILE +#define ONNX_CLIP_PARAMS_SIZE ALIGN_4B(sizeof(onnx_clip_params_t)) + +#define INPUT_VEC_BASE ALIGN_4B(ONNX_CLIP_PARAMS_BASE + ONNX_CLIP_PARAMS_SIZE) +#define INPUT_VEC_SIZE ALIGN_4B(VEC_SIZE) + +#define MIN_VAL_BASE ALIGN_4B(INPUT_VEC_BASE + INPUT_VEC_SIZE) +#define MIN_VAL_SIZE ALIGN_4B(SCALAR_SIZE) + +#define MAX_VAL_BASE ALIGN_4B(MIN_VAL_BASE + MIN_VAL_SIZE) +#define MAX_VAL_SIZE ALIGN_4B(SCALAR_SIZE) + +#define RES_BASE ALIGN_4B(MAX_VAL_BASE + MAX_VAL_SIZE) +#define RES_SIZE ALIGN_4B(VEC_SIZE) + +#define EXP_BASE ALIGN_4B(RES_BASE + RES_SIZE) +#define EXP_SIZE ALIGN_4B(VEC_SIZE) + +#endif /* ONNX_CLIP_MEM_LAYOUT_H_ */ diff --git a/tests/spatz_on_magia/onnx_clip/include/onnx_clip_params.h b/tests/spatz_on_magia/onnx_clip/include/onnx_clip_params.h new file mode 100644 index 00000000..b2deeeed --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/include/onnx_clip_params.h @@ -0,0 +1,14 @@ +#ifndef ONNX_CLIP_PARAMS_H_ +#define ONNX_CLIP_PARAMS_H_ + +#include +typedef struct { + uintptr_t addr_input; + uintptr_t addr_res; + uintptr_t addr_exp; + uintptr_t addr_min; + uintptr_t addr_max; + uint32_t len; +} onnx_clip_params_t; + +#endif /* ONNX_CLIP_PARAMS_H_ */ diff --git a/tests/spatz_on_magia/onnx_clip/main.c b/tests/spatz_on_magia/onnx_clip/main.c new file mode 100644 index 00000000..639c1785 --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/main.c @@ -0,0 +1,112 @@ +#include "tile.h" +#include "eventunit.h" + +#include "compare_utils.h" +#include "data.h" +#include "onnx_clip_mem_layout.h" +#include "onnx_clip_params.h" +#include "onnx_clip_task_bin.h" + +static int init_data(void *params) +{ + uint32_t offset; + volatile onnx_clip_params_t *clip_params; + + clip_params = (volatile onnx_clip_params_t *) params; + for (int i = 0; i < LEN; i++) { + offset = i * sizeof(float16); + + mmio_fp16(INPUT_VEC_BASE + offset) = input_vec[i]; + mmio_fp16(EXP_BASE + offset) = expected[i]; + mmio_fp16(RES_BASE + offset) = 0; + } + + mmio_fp16(MIN_VAL_BASE) = min_val; + mmio_fp16(MAX_VAL_BASE) = max_val; + + clip_params->addr_input = INPUT_VEC_BASE; + clip_params->addr_min = MIN_VAL_BASE; + clip_params->addr_max = MAX_VAL_BASE; + clip_params->addr_exp = EXP_BASE; + clip_params->addr_res = RES_BASE; + clip_params->len = LEN; + + return 0; +} + +static int run_spatz_task() +{ + int ret; + eu_config_t eu_cfg; + eu_controller_t eu_ctrl; + + eu_cfg.hartid = get_hartid(); + eu_ctrl.base = NULL, + eu_ctrl.cfg = &eu_cfg, + eu_ctrl.api = &eu_api, + + eu_init(&eu_ctrl); + eu_spatz_init(&eu_ctrl, 0); + + spatz_init(SPATZ_BINARY_START); + spatz_run_task_with_params(ONNX_CLIP_TASK, ONNX_CLIP_PARAMS_BASE); + + eu_spatz_wait(&eu_ctrl, WFE); + + ret = spatz_get_exit_code(); + + spatz_clk_dis(); + + return ret; +} + +static bool check_result(void *params) +{ + volatile onnx_clip_params_t *clip_params; + clip_params = (volatile onnx_clip_params_t *) params; + return vector_compare_fp16_bitwise(clip_params->addr_res, clip_params->addr_exp, clip_params->len); +} + +static int run_test() +{ + int ret; + bool check; + volatile onnx_clip_params_t *params; + + params = (volatile onnx_clip_params_t *) ONNX_CLIP_PARAMS_BASE; + + ret = init_data(params); + if (ret != 0) { + printf("[CV32] Params initialization failed with error: %d\n", ret); + return ret; + } + + ret = run_spatz_task(); + if (ret != 0) { + printf("[CV32] Spatz task FAILED with error: %d\n", ret); + return ret; + } + + check = check_result(params); + if (check) { + printf("[CV32] Test SUCCESS\n"); + } else { + printf("[CV32] Test FAILED\n"); + ret = -1; + } + + return ret; +} + +int main(void) +{ + int ret; + + printf("\n##################################### ONNX_CLIP TEST #####################################\n\n"); + + ret = run_test(); + + printf("\n##########################################################################################\n\n"); + + return ret; +} diff --git a/tests/spatz_on_magia/onnx_clip/spatz_task/onnx_clip_task.c b/tests/spatz_on_magia/onnx_clip/spatz_task/onnx_clip_task.c new file mode 100644 index 00000000..3641df2a --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/spatz_task/onnx_clip_task.c @@ -0,0 +1,41 @@ +#include "tile.h" +#include "onnx_clip_params.h" + +int onnx_clip_task(void) +{ + volatile onnx_clip_params_t *params; + uintptr_t params_addr; + + _Float16 *result; + _Float16 *input; + _Float16 min; + _Float16 max; + + size_t avl; + size_t vl; + + params_addr = mmio32(SPATZ_DATA); + params = (volatile onnx_clip_params_t *) params_addr; + + input = (_Float16 *)params->addr_input; + result = (_Float16 *)params->addr_res; + min = *(_Float16 *)params->addr_min; + max = *(_Float16 *)params->addr_max; + avl = params->len; + + for (; avl > 0; avl -= vl) { + asm volatile ("vsetvli %0, %1, e16, m8, ta, ma" : "=r"(vl) : "r"(avl)); + + asm volatile ("vle16.v v0, (%0)" :: "r"(input)); + + asm volatile ("vfmin.vf v8, v0, %0" :: "f"(max)); + asm volatile ("vfmax.vf v8, v8, %0" :: "f"(min)); + + asm volatile ("vse16.v v8, (%0)" :: "r"(result)); + + result += vl; + input += vl; + } + + return 0; +} diff --git a/tests/spatz_on_magia/onnx_clip/test_data/data.h b/tests/spatz_on_magia/onnx_clip/test_data/data.h new file mode 100644 index 00000000..2b5ff1ff --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/test_data/data.h @@ -0,0 +1,12 @@ +/* Automatically generated header file for Spatz ONNX testing */ +#ifndef DATA_H_ +#define DATA_H_ + +#define LEN 2048 + +static const float16 input_vec[] = { 5.062500f, 19.921875f, -2.808594f, 3.906250f, 16.718750f, -2.402344f, -1.770508f, 14.242188f, 20.046875f, 7.382812f, 3.841797f, 2.298828f, -17.406250f, 25.203125f, 6.218750f, 1.691406f, -10.265625f, -19.421875f, 7.781250f, -2.794922f, 12.164062f, 0.761719f, -5.367188f, 4.867188f, 6.097656f, -0.366943f, -2.781250f, 10.375000f, -5.710938f, -10.367188f, 3.687500f, -10.156250f, 4.812500f, 18.796875f, 9.296875f, 2.417969f, -5.730469f, 3.048828f, 0.258789f, 10.000000f, -7.953125f, -2.646484f, 1.547852f, -0.626465f, -3.564453f, -28.203125f, -13.375000f, -4.976562f, -0.637207f, -0.257812f, -21.453125f, -16.203125f, 4.296875f, -15.921875f, 9.656250f, -12.281250f, 0.331299f, 0.023376f, 7.332031f, -20.156250f, 8.476562f, 15.656250f, 11.125000f, -15.171875f, 8.312500f, -0.458008f, -11.156250f, 0.671387f, -7.156250f, -6.640625f, -5.542969f, 5.597656f, 0.870117f, 11.359375f, 2.376953f, -16.062500f, -1.016602f, -1.394531f, -0.675781f, -0.872070f, 0.842285f, -1.569336f, 7.761719f, -4.023438f, -2.041016f, -11.054688f, -4.398438f, 0.016647f, 0.061279f, 2.457031f, 25.203125f, 23.921875f, -0.462646f, -16.312500f, 9.445312f, 19.156250f, 6.988281f, -19.515625f, -7.625000f, -12.171875f, -6.218750f, -2.687500f, 3.720703f, 2.718750f, -11.164062f, 15.265625f, -6.910156f, 6.003906f, -10.562500f, 8.132812f, 18.109375f, -13.875000f, 6.855469f, 4.691406f, -6.203125f, -7.417969f, -15.554688f, 23.625000f, 22.265625f, -2.857422f, 1.242188f, 12.953125f, -0.638184f, -8.093750f, -8.500000f, 8.742188f, 0.336670f, -2.767578f, -9.687500f, 23.390625f, -16.921875f, 7.562500f, 12.367188f, -2.212891f, 9.132812f, -0.349609f, 3.035156f, -0.456787f, 3.541016f, -3.666016f, 8.898438f, 4.324219f, -8.390625f, 15.289062f, -10.820312f, 2.113281f, 7.191406f, 11.632812f, 9.609375f, 6.191406f, 13.945312f, 4.316406f, 10.179688f, 24.765625f, -3.472656f, 3.208984f, -2.917969f, 2.578125f, -11.265625f, -17.796875f, -17.625000f, 10.539062f, -5.335938f, 7.394531f, 5.742188f, -10.531250f, -5.902344f, 13.679688f, -20.390625f, -9.648438f, -0.414551f, 0.672852f, 9.671875f, -5.855469f, -4.949219f, -28.812500f, -7.359375f, 4.492188f, 1.772461f, -11.195312f, 3.822266f, 2.144531f, -6.390625f, -6.578125f, 5.605469f, -0.882324f, 14.578125f, -7.132812f, 10.875000f, -7.953125f, 9.148438f, 4.789062f, 4.398438f, -11.796875f, 11.968750f, -13.578125f, 1.472656f, 0.180786f, -6.214844f, -7.144531f, -28.796875f, -15.460938f, 5.187500f, 12.015625f, 7.199219f, -9.882812f, -3.003906f, -1.137695f, -2.757812f, -5.007812f, -4.589844f, 11.328125f, -14.750000f, 5.742188f, -0.018524f, -13.562500f, -1.334961f, -9.304688f, -16.093750f, 6.449219f, -8.171875f, -13.210938f, -11.742188f, 6.835938f, 7.917969f, 7.691406f, 11.242188f, -7.785156f, 8.703125f, -1.873047f, 24.390625f, 28.515625f, 3.457031f, 11.242188f, 16.468750f, 2.667969f, 9.429688f, -6.980469f, -12.757812f, -1.304688f, -15.562500f, 0.024933f, -22.687500f, -8.804688f, 18.484375f, -0.554688f, -6.117188f, 2.580078f, 4.699219f, 4.363281f, 2.255859f, -4.539062f, -12.671875f, 1.221680f, -4.238281f, 16.390625f, 2.539062f, -16.328125f, 0.538086f, -1.554688f, -5.195312f, -6.164062f, -19.343750f, 8.984375f, -7.191406f, 8.710938f, -1.295898f, 14.445312f, 12.789062f, 0.256348f, -9.132812f, 1.065430f, -11.968750f, -21.281250f, -4.863281f, -11.656250f, 0.661621f, -4.621094f, -13.671875f, 8.070312f, -17.375000f, 21.015625f, -1.147461f, 0.382324f, 14.710938f, 20.875000f, -1.817383f, -5.703125f, -14.601562f, -3.425781f, 9.984375f, 6.960938f, 2.152344f, 4.054688f, -6.257812f, -2.062500f, 3.919922f, -1.499023f, 4.417969f, 2.218750f, 8.476562f, -4.023438f, 7.675781f, -11.406250f, 0.330322f, -12.671875f, 8.968750f, 1.190430f, 11.796875f, 13.703125f, -0.432617f, 5.691406f, 2.125000f, 0.469482f, 14.468750f, 11.164062f, 0.600098f, 7.734375f, 12.914062f, 4.281250f, -1.070312f, -9.140625f, 11.468750f, 3.509766f, 5.722656f, -5.585938f, -28.140625f, -6.484375f, 6.171875f, -5.878906f, -8.914062f, 6.085938f, 1.708008f, 9.500000f, -6.652344f, 1.345703f, -17.593750f, 12.625000f, 1.398438f, -10.085938f, -3.496094f, -6.363281f, -7.062500f, -12.218750f, -6.945312f, -11.117188f, -11.625000f, 0.591797f, -9.507812f, -12.117188f, -5.648438f, -9.570312f, 3.835938f, 13.867188f, 9.320312f, -4.339844f, 6.062500f, -6.464844f, -20.703125f, 3.712891f, 2.759766f, 2.037109f, 9.054688f, -8.406250f, 1.660156f, -3.876953f, 2.851562f, -8.453125f, -13.656250f, 9.492188f, 2.328125f, -10.367188f, 18.765625f, -1.257812f, 1.274414f, 14.195312f, 4.394531f, -15.265625f, 4.902344f, -2.511719f, -1.938477f, -0.682617f, -0.805664f, 13.359375f, -15.585938f, 7.097656f, 21.718750f, 4.011719f, 0.913086f, 6.542969f, 29.593750f, 3.250000f, 7.750000f, 3.845703f, -4.070312f, 10.460938f, -11.046875f, -2.904297f, 1.387695f, 0.667969f, -6.664062f, 14.742188f, -0.638672f, 0.547852f, -23.093750f, 4.687500f, -13.085938f, -8.007812f, 9.539062f, -3.539062f, -6.605469f, -3.650391f, 0.606934f, -16.656250f, 2.562500f, -0.960449f, 1.914062f, 4.453125f, 0.057831f, 5.609375f, 5.027344f, 7.292969f, -5.613281f, 7.664062f, -14.335938f, 19.156250f, 2.908203f, -17.031250f, -7.593750f, 22.156250f, 10.968750f, 1.789062f, 5.394531f, -0.011292f, -2.056641f, -9.281250f, -5.886719f, 2.177734f, -14.648438f, -5.875000f, -15.179688f, -1.727539f, -7.105469f, -4.480469f, 4.125000f, -1.218750f, -12.171875f, 6.226562f, 1.337891f, 10.054688f, -15.234375f, 19.875000f, 16.125000f, -5.738281f, 26.796875f, 11.062500f, 7.332031f, -4.437500f, -10.109375f, -2.744141f, 2.724609f, -13.992188f, 4.136719f, -4.753906f, 2.720703f, 3.832031f, 6.804688f, 6.585938f, 4.019531f, 0.641602f, -3.208984f, 6.574219f, 19.218750f, 5.371094f, -3.337891f, 19.687500f, -2.724609f, -0.476318f, -14.218750f, 13.445312f, 4.156250f, 3.769531f, -12.500000f, 7.996094f, -5.046875f, -1.600586f, 1.039062f, 13.375000f, -2.500000f, -6.253906f, -19.703125f, 16.890625f, 11.039062f, -15.070312f, -13.625000f, 19.703125f, 5.304688f, 1.453125f, -13.656250f, 10.398438f, 7.707031f, -10.460938f, 12.015625f, 21.296875f, -10.101562f, -15.914062f, -30.421875f, 3.808594f, 1.636719f, -14.968750f, 7.242188f, -10.578125f, -10.234375f, 7.539062f, 5.226562f, 3.537109f, -10.234375f, 6.640625f, 11.382812f, -0.225586f, 0.172729f, 1.709961f, 11.398438f, 4.664062f, -13.312500f, 5.472656f, -2.917969f, -15.437500f, -16.687500f, -1.251953f, 14.835938f, -4.789062f, -0.067627f, 29.515625f, 0.263184f, -9.773438f, 14.859375f, -11.460938f, 11.281250f, -12.421875f, -5.675781f, -25.640625f, 1.407227f, -4.777344f, 11.273438f, -5.113281f, -18.453125f, -8.640625f, 5.949219f, 0.109985f, 18.171875f, 20.125000f, 24.656250f, 9.632812f, -3.679688f, 7.917969f, 10.070312f, -5.605469f, -10.046875f, 13.226562f, -20.953125f, -5.484375f, 13.507812f, 2.648438f, -7.035156f, 14.335938f, -13.445312f, -1.238281f, -9.984375f, -12.945312f, -7.222656f, -3.974609f, 5.042969f, -7.074219f, -6.445312f, 2.724609f, -2.425781f, 11.125000f, -3.998047f, 4.394531f, 5.671875f, -16.921875f, 6.859375f, 2.822266f, -4.234375f, 4.691406f, 4.210938f, -4.960938f, -0.245972f, -44.656250f, -9.140625f, 5.359375f, 0.563965f, 19.937500f, 1.136719f, 21.953125f, 4.269531f, -14.164062f, 1.148438f, -21.375000f, 12.179688f, 0.612793f, -15.171875f, 2.679688f, -14.734375f, -11.132812f, -10.796875f, 13.968750f, 2.169922f, 14.937500f, 11.500000f, -5.484375f, 1.376953f, -14.539062f, 2.277344f, -2.908203f, -10.304688f, 4.519531f, 11.421875f, 6.417969f, 9.875000f, -3.804688f, 7.195312f, 0.005409f, 5.050781f, -7.218750f, 12.640625f, 13.929688f, -12.812500f, -18.078125f, 7.257812f, -1.008789f, -14.648438f, -9.484375f, 21.000000f, -2.269531f, -2.103516f, -0.542480f, -3.148438f, -4.140625f, -7.164062f, -11.640625f, 6.855469f, 11.890625f, 10.148438f, 12.625000f, 9.257812f, 8.851562f, -14.351562f, 15.679688f, 16.984375f, -12.054688f, 10.343750f, -2.326172f, 18.578125f, 9.898438f, -14.453125f, 13.570312f, -9.710938f, -4.980469f, -19.109375f, -2.578125f, -3.662109f, 4.906250f, -9.968750f, 8.843750f, 13.585938f, 6.484375f, 8.703125f, 6.027344f, 0.803223f, -7.289062f, 1.192383f, 3.525391f, 8.578125f, 4.781250f, 2.400391f, 8.710938f, -3.789062f, -5.296875f, -11.421875f, -4.621094f, 2.472656f, -3.169922f, -4.964844f, -0.406006f, 2.029297f, -1.854492f, -13.703125f, 4.308594f, 1.157227f, 1.907227f, 8.187500f, 3.099609f, 9.625000f, 15.289062f, 21.359375f, -11.093750f, 9.328125f, 14.789062f, 3.574219f, 14.671875f, -0.086853f, -1.828125f, 8.859375f, 0.217529f, 11.351562f, -1.333984f, 10.820312f, -3.009766f, -4.195312f, 3.179688f, -5.488281f, -14.070312f, 4.003906f, 2.953125f, 10.328125f, 7.648438f, 4.652344f, 16.859375f, -5.503906f, 0.506836f, 6.570312f, 5.558594f, -11.289062f, -8.585938f, -6.687500f, -12.281250f, -0.050964f, -2.933594f, -6.644531f, 4.000000f, -4.910156f, -9.164062f, -2.101562f, -16.375000f, -16.250000f, -0.207520f, 6.382812f, 2.978516f, -4.722656f, 10.882812f, 2.298828f, -15.648438f, -14.921875f, -0.279541f, -8.484375f, 7.210938f, 11.640625f, -9.726562f, -3.718750f, 0.416992f, -7.890625f, 0.890137f, 1.445312f, -4.507812f, -3.591797f, 8.273438f, 4.300781f, 8.226562f, -0.015251f, 10.898438f, -5.324219f, 1.726562f, -1.801758f, 6.210938f, 8.046875f, -4.757812f, -0.826660f, 4.796875f, 12.367188f, 7.335938f, 0.619629f, 7.429688f, 6.238281f, 8.335938f, -13.617188f, 8.367188f, -2.109375f, 0.155884f, 4.019531f, -1.195312f, 4.000000f, 14.968750f, -1.419922f, -22.781250f, 17.125000f, 1.264648f, 6.152344f, 17.031250f, 7.386719f, -1.012695f, 18.468750f, 4.089844f, -9.156250f, 10.781250f, 4.531250f, 2.343750f, -18.718750f, 1.572266f, 18.703125f, -23.046875f, -9.390625f, 16.015625f, 9.367188f, 4.750000f, -11.734375f, -2.566406f, -21.250000f, -0.991699f, -4.816406f, 1.274414f, 3.363281f, 3.896484f, 19.406250f, -23.125000f, -13.664062f, 9.218750f, 7.437500f, -6.679688f, -2.837891f, 6.070312f, 6.445312f, -6.066406f, 3.789062f, 3.765625f, -4.351562f, 4.023438f, -9.421875f, 10.890625f, 6.726562f, -1.788086f, 20.062500f, 3.681641f, -13.390625f, -8.992188f, 5.500000f, -7.906250f, 6.261719f, 16.265625f, 15.476562f, 3.121094f, 1.127930f, 0.982422f, -3.095703f, -17.750000f, -2.900391f, -2.419922f, -5.312500f, 19.109375f, -17.343750f, -9.023438f, -14.000000f, 1.553711f, -5.726562f, 7.253906f, 18.187500f, 0.348633f, -7.164062f, 6.152344f, 4.242188f, 5.296875f, -3.275391f, -2.462891f, 22.515625f, -2.212891f, 7.707031f, -10.492188f, 4.000000f, 22.078125f, -1.268555f, 10.398438f, 8.343750f, -5.769531f, 3.437500f, -4.023438f, -12.078125f, -18.781250f, -7.367188f, 0.614258f, -0.435547f, -15.906250f, -8.664062f, -10.023438f, 9.976562f, 17.593750f, -15.578125f, 7.269531f, 1.741211f, -12.609375f, 2.580078f, -7.468750f, -11.328125f, 12.906250f, 3.373047f, -15.992188f, 6.488281f, 5.171875f, -4.363281f, 2.199219f, 3.169922f, -1.734375f, 12.921875f, 0.979004f, -5.628906f, 7.910156f, -2.798828f, 4.832031f, 5.144531f, 5.175781f, -0.265625f, 4.207031f, 14.914062f, 0.057251f, 15.367188f, -18.578125f, 7.597656f, 1.343750f, -3.564453f, 6.152344f, 0.045563f, -0.333496f, -4.613281f, 18.515625f, 0.306885f, -10.468750f, -24.062500f, -4.453125f, 6.179688f, 10.500000f, -18.109375f, 2.400391f, -3.437500f, 5.636719f, 2.951172f, 0.159424f, 5.304688f, -7.429688f, -0.469971f, 9.632812f, 4.835938f, 7.253906f, 9.773438f, 6.859375f, 1.550781f, 6.472656f, -0.766113f, -18.953125f, 7.992188f, 3.888672f, 1.912109f, -8.710938f, -0.570801f, 9.421875f, 2.240234f, 15.640625f, -11.070312f, -13.484375f, 1.448242f, -11.218750f, 0.868652f, 6.527344f, 0.831543f, -8.476562f, 14.718750f, -11.265625f, 7.914062f, -13.085938f, -5.160156f, -15.437500f, 14.789062f, -8.789062f, -0.429443f, 15.960938f, 6.156250f, 0.110779f, 4.875000f, 11.867188f, 0.320068f, -3.972656f, -1.533203f, -0.380859f, -5.585938f, 7.562500f, -16.656250f, 22.312500f, 14.164062f, -11.234375f, -1.147461f, 0.249756f, 3.753906f, -5.851562f, -28.250000f, -4.414062f, 0.599121f, -20.046875f, -1.142578f, -15.250000f, 2.728516f, 2.943359f, 9.742188f, 1.430664f, 17.093750f, 7.082031f, 2.320312f, 7.203125f, 4.132812f, -7.152344f, -0.589355f, 8.875000f, 4.835938f, -0.407471f, -1.727539f, -22.984375f, -9.164062f, 1.875977f, 5.820312f, 9.546875f, -2.287109f, 0.034332f, -7.625000f, -19.671875f, -5.144531f, -6.070312f, -1.679688f, 5.601562f, -9.000000f, -0.353027f, -6.660156f, -1.754883f, -13.515625f, 17.078125f, 6.914062f, 0.134766f, -10.367188f, -2.464844f, 1.695312f, 5.265625f, -2.457031f, 0.081177f, 4.082031f, 14.140625f, -14.242188f, -23.625000f, 34.687500f, 7.519531f, 3.123047f, 2.097656f, 11.851562f, -13.210938f, -8.789062f, -4.289062f, -17.765625f, 15.132812f, -6.203125f, 5.820312f, -12.742188f, -0.219849f, 5.632812f, 4.156250f, -2.970703f, 0.750488f, 10.289062f, -0.438232f, -5.808594f, 4.664062f, 8.578125f, 33.218750f, 1.136719f, 7.359375f, -1.896484f, -17.546875f, 3.787109f, 4.492188f, -3.150391f, -11.578125f, 4.765625f, -1.725586f, -4.226562f, -6.148438f, 4.605469f, -2.324219f, 1.339844f, 10.648438f, 1.154297f, 31.515625f, 5.652344f, 6.914062f, 7.542969f, -0.362549f, -9.546875f, 8.039062f, 9.156250f, 6.472656f, -10.703125f, -6.746094f, 10.640625f, 7.460938f, -5.699219f, -4.238281f, 1.440430f, 3.650391f, -2.492188f, 2.775391f, -5.500000f, -16.390625f, -12.437500f, 14.015625f, 18.515625f, -13.765625f, -9.835938f, -10.101562f, 11.601562f, 16.953125f, -4.988281f, 15.601562f, 8.867188f, 0.647461f, 11.734375f, 4.753906f, -2.029297f, 2.931641f, 5.296875f, 4.105469f, 20.218750f, 12.890625f, -0.045959f, 0.124207f, -18.531250f, -4.664062f, 5.128906f, 3.244141f, -13.687500f, -14.882812f, -12.312500f, 5.964844f, 11.070312f, -7.148438f, -0.971680f, 5.531250f, -1.369141f, 10.265625f, -8.773438f, -5.347656f, -4.972656f, 7.265625f, 3.728516f, 16.718750f, -1.668945f, -0.595215f, 4.941406f, -5.796875f, 20.625000f, -3.132812f, 6.535156f, -15.187500f, 17.140625f, -0.906250f, -19.609375f, 5.781250f, -6.761719f, -0.615234f, -12.742188f, -3.970703f, 6.332031f, 24.000000f, -11.531250f, 2.609375f, 12.382812f, 0.104309f, 6.914062f, -1.954102f, -1.468750f, 5.929688f, 9.906250f, 11.484375f, 12.117188f, -10.632812f, 1.847656f, 4.906250f, -3.796875f, -1.178711f, 3.404297f, -18.250000f, 1.322266f, 0.804199f, -10.109375f, -6.519531f, -10.914062f, 5.519531f, -13.476562f, -1.863281f, 0.950684f, -9.882812f, 10.078125f, -7.761719f, -5.175781f, 10.875000f, -4.843750f, 15.210938f, 4.789062f, -1.625000f, -1.651367f, -9.937500f, 3.744141f, -0.253418f, 4.867188f, 1.367188f, 1.846680f, 7.484375f, 1.194336f, 2.162109f, -9.492188f, -16.078125f, 4.351562f, -8.585938f, 5.550781f, -9.531250f, -9.070312f, -27.125000f, 4.496094f, 21.765625f, -2.630859f, 4.886719f, 0.705566f, 19.703125f, -9.039062f, -13.695312f, 2.330078f, 9.226562f, -3.517578f, 1.130859f, 2.816406f, 6.167969f, -3.369141f, -0.565430f, -9.453125f, -0.049805f, 13.070312f, 5.734375f, -6.687500f, -11.695312f, -10.554688f, 14.593750f, -22.140625f, -1.067383f, 1.041016f, -4.054688f, -0.302246f, 6.746094f, 20.093750f, -17.468750f, -14.523438f, -7.554688f, 5.093750f, 19.359375f, 1.894531f, 10.414062f, 13.226562f, 21.484375f, 13.453125f, 17.500000f, 8.750000f, 9.015625f, -14.398438f, -13.460938f, 0.108337f, -1.505859f, 3.984375f, 1.970703f, 4.082031f, 7.304688f, -3.238281f, -5.339844f, -5.820312f, 6.832031f, 1.647461f, -0.320801f, 20.234375f, 3.541016f, 7.089844f, 1.440430f, 18.671875f, -1.457031f, -3.884766f, 9.703125f, 1.930664f, 9.515625f, -4.050781f, 13.531250f, -2.394531f, 8.453125f, -10.343750f, 18.359375f, 5.929688f, 6.570312f, 3.789062f, -6.925781f, -5.042969f, 4.960938f, 0.454834f, -7.031250f, 13.054688f, 16.390625f, -2.888672f, 3.402344f, -7.648438f, 9.476562f, 4.320312f, -6.085938f, 6.058594f, 7.210938f, -6.574219f, -6.128906f, 6.656250f, 22.265625f, 7.671875f, -13.218750f, -1.315430f, 8.671875f, -11.429688f, -7.296875f, 6.273438f, 5.113281f, 3.541016f, -8.578125f, 10.375000f, 10.335938f, 8.500000f, 1.320312f, 1.143555f, 2.488281f, -7.144531f, 12.757812f, -13.734375f, 3.078125f, -13.304688f, -3.433594f, -9.257812f, -4.414062f, -4.804688f, -1.407227f, -1.355469f, -16.531250f, -0.401123f, 29.437500f, 0.613770f, 7.960938f, -16.890625f, 4.675781f, -1.982422f, 3.283203f, -10.171875f, 8.218750f, 3.259766f, -10.265625f, -12.359375f, -16.046875f, 15.351562f, 4.121094f, 9.351562f, -17.625000f, -4.746094f, -4.652344f, -4.042969f, -11.296875f, 1.207031f, 10.429688f, 2.347656f, -15.890625f, -4.503906f, -2.902344f, -1.708008f, -3.849609f, -8.171875f, 12.195312f, -5.707031f, -10.625000f, -10.125000f, 17.843750f, -9.765625f, 26.640625f, 15.500000f, 2.080078f, -9.843750f, 5.695312f, -23.250000f, -3.224609f, -10.093750f, -9.781250f, -5.171875f, 9.664062f, -1.185547f, -9.281250f, -13.093750f, -10.125000f, 14.476562f, -2.423828f, 13.148438f, -4.648438f, 1.208008f, 5.250000f, 9.445312f, -10.062500f, 16.750000f, -3.095703f, -3.373047f, 0.571777f, -6.039062f, 9.843750f, -5.570312f, -6.941406f, -6.914062f, -0.615234f, 8.406250f, 9.781250f, -8.531250f, -2.779297f, -7.355469f, -11.539062f, 9.531250f, 18.171875f, 4.062500f, -0.013100f, 0.016052f, 2.531250f, 3.812500f, 10.648438f, 10.046875f, -13.921875f, 6.265625f, -8.234375f, -6.988281f, 4.628906f, -5.171875f, 10.289062f, 8.757812f, -3.447266f, 8.039062f, 5.066406f, 12.937500f, 1.721680f, -3.269531f, -0.505859f, 0.158813f, -3.886719f, -3.345703f, -4.042969f, -0.747070f, -18.046875f, -0.142822f, 12.414062f, -5.957031f, -4.675781f, 1.763672f, -2.078125f, 2.703125f, 2.173828f, 3.703125f, 1.984375f, -3.910156f, 22.562500f, -4.445312f, 3.130859f, -3.587891f, 6.597656f, -3.814453f, -10.085938f, 5.125000f, 3.914062f, -1.489258f, 13.312500f, 9.882812f, 11.710938f, -5.050781f, 7.492188f, -9.703125f, 9.187500f, 5.687500f, -0.451416f, -6.800781f, 5.578125f, 9.257812f, -13.281250f, 8.148438f, 4.441406f, 15.023438f, -0.763184f, 7.988281f, 19.078125f, -13.281250f, 0.649414f, -7.187500f, 11.414062f, 5.976562f, 9.492188f, -16.671875f, -8.515625f, 22.421875f, 5.238281f, 12.945312f, -0.001776f, 5.273438f, -5.250000f, -18.171875f, 9.671875f, -8.539062f, -6.355469f, 17.296875f, 6.515625f, -13.515625f, 7.785156f, 3.888672f, -4.312500f, 10.976562f, 2.179688f, -1.838867f, 0.095032f, 3.710938f, 24.000000f, 10.765625f, -14.187500f, -21.156250f, -0.802246f, 6.277344f, 1.205078f, 7.980469f, -20.375000f, -5.171875f, -10.570312f, 18.968750f, 29.640625f, 9.265625f, -1.155273f, -1.240234f, 8.859375f, 11.429688f, -2.833984f, -1.505859f, -16.484375f, 16.359375f, 1.352539f, 13.195312f, 6.828125f, 17.937500f, 4.167969f, 9.726562f, 0.022339f, 16.046875f, -0.683105f, -4.035156f, -11.414062f, -7.167969f, -15.953125f, -9.820312f, 6.078125f, 10.054688f, -12.781250f, 4.109375f, 4.707031f, 4.695312f, 11.843750f, -23.515625f, 3.140625f, -2.468750f, -1.955078f, 4.378906f, 15.914062f, -4.242188f, -14.500000f, -2.976562f, -3.632812f, 5.867188f, 19.265625f, 19.062500f, 10.210938f, 9.453125f, -7.359375f, 5.902344f, -8.976562f, 7.003906f, -16.000000f, -6.738281f, 8.062500f, 11.632812f, -7.308594f, 2.755859f, -11.835938f, -10.664062f, -7.195312f, -7.777344f, -5.457031f, 0.488281f, 3.013672f, 10.445312f, 1.414062f, 1.024414f, 12.742188f, 6.605469f, -2.482422f, -16.031250f, 3.640625f, 0.425781f, -3.849609f, 13.929688f, 6.601562f, -7.476562f, -0.965332f, -3.310547f, 2.828125f, 8.960938f, -33.156250f, -3.699219f, -5.945312f, 1.919922f, -6.675781f, -16.781250f, 5.093750f, -0.670898f, -18.953125f, -0.916016f, -5.953125f, -19.656250f, 23.125000f, -7.296875f, 22.171875f, -5.886719f, 3.460938f, -8.429688f, 0.007805f, 12.750000f, -0.564941f, -6.109375f, -11.085938f, -7.046875f, 9.265625f, 5.265625f, 3.501953f, -5.160156f, -1.670898f, -9.304688f, 1.069336f, 5.261719f, 4.433594f, -25.265625f, 13.062500f, -2.705078f, -2.398438f, -2.222656f, 14.367188f, -4.882812f, -4.640625f, 6.082031f, 16.953125f, 5.230469f, 0.397949f, 7.273438f, 4.148438f, 2.650391f, -12.562500f, 9.656250f, 10.812500f, 0.575684f, -0.367188f, -25.359375f, -11.414062f, 2.087891f, -4.746094f, 4.394531f, -9.562500f, 3.201172f, -10.734375f, 16.296875f, -8.500000f, -1.680664f, 14.359375f, -5.363281f, 7.605469f, 15.507812f, 4.250000f, 2.011719f, 8.953125f, 0.166992f, 4.402344f, -17.281250f, 10.257812f, 4.410156f, -21.937500f, -1.259766f, 15.632812f, 5.925781f, -12.054688f, 2.136719f, -0.063293f, -12.203125f, 7.894531f, 29.250000f, -5.179688f, -15.062500f, 11.078125f, -5.953125f, -10.453125f, -1.941406f, -1.483398f, 4.015625f, -7.984375f, 2.625000f, 12.265625f, -11.093750f, -1.731445f, 3.414062f, -4.031250f, 4.488281f, -2.994141f, -5.429688f, -1.330078f, 12.742188f, 1.086914f, 7.835938f, 11.257812f, 9.023438f, -0.422119f, 5.304688f, 16.109375f, 7.277344f, 8.054688f, 3.439453f, -18.734375f, -15.359375f, 7.281250f, 8.304688f, -6.773438f, 9.312500f, -11.296875f, 3.695312f, 4.757812f, 14.429688f, 9.265625f, -4.296875f, -5.800781f, 1.625977f, -6.667969f, 12.726562f, -7.125000f, 3.962891f, -8.312500f, -12.148438f, -14.015625f, 8.437500f, 1.345703f, 7.175781f, -4.039062f, -3.585938f, -7.167969f, 2.748047f, -10.304688f, 2.783203f, 15.304688f, 5.148438f, -10.335938f, -0.645508f, -11.585938f, 10.953125f, -1.397461f, -25.484375f, 20.640625f, -9.210938f, 3.335938f, -6.613281f, 27.562500f, 15.921875f, -14.320312f, 18.187500f, -12.679688f, 4.648438f, -13.820312f, -4.953125f, -2.052734f, 15.617188f, -3.146484f, -18.281250f, -0.649902f, 14.617188f, 16.218750f, -10.429688f, 6.824219f, -4.054688f, -5.128906f, 3.882812f, -8.476562f, -5.601562f, 1.890625f, 1.994141f, -26.984375f, 16.593750f, -3.156250f, -12.531250f, 9.460938f, 7.203125f, 3.869141f, -12.054688f, -22.765625f, 7.070312f, 0.105774f, 0.789551f, 1.774414f, 4.253906f, 6.289062f, 5.085938f, -11.125000f, -3.406250f, 2.427734f, -9.375000f, -1.005859f, -6.304688f, -7.046875f, 21.875000f, -0.953125f, 13.390625f, 3.193359f, -6.960938f, -6.980469f, -2.804688f, 5.058594f, -21.000000f, 12.585938f, -5.496094f, -18.015625f, -8.625000f, 24.156250f, -5.179688f, 1.222656f, -16.078125f, 3.861328f, -10.203125f, 0.800293f, 0.203613f, 9.820312f, -9.062500f, 1.699219f, -23.640625f, 4.546875f, 2.171875f, -7.769531f, -10.078125f, 12.945312f, 20.437500f, 18.515625f, -0.297852f, 8.453125f, -10.953125f, -11.945312f, -4.242188f, -1.308594f, 20.453125f, -2.158203f, 9.507812f, -5.136719f, 8.375000f, 2.962891f, -4.601562f, -2.976562f, 6.070312f, 10.468750f, -6.769531f, 9.414062f, 2.929688f, -2.990234f, -4.875000f, -8.187500f, 10.390625f, 3.802734f, -10.726562f, -13.414062f, -15.882812f, 12.390625f, -3.441406f, -29.281250f, 5.046875f, -6.265625f, -8.890625f, 1.815430f, 13.312500f, -12.257812f, 11.148438f, -9.046875f, 18.375000f, -0.316895f, 5.468750f, 2.164062f, 19.906250f, 5.582031f, -9.351562f, 3.095703f, 5.468750f, -0.825684f, 2.208984f, -9.898438f, -2.675781f, 15.046875f, -1.788086f, -7.410156f, 3.138672f, -20.812500f, -14.304688f, -6.550781f, 3.351562f, 17.687500f, -9.679688f, 6.695312f, -4.359375f, -0.132324f, 15.093750f, -5.406250f, -7.335938f, 14.742188f, -9.820312f, -1.004883f, -15.492188f, 3.732422f, -2.605469f, 4.472656f, 10.726562f, -17.671875f, 13.390625f, -9.390625f, 6.289062f, 2.562500f, -8.671875f, 13.562500f, 0.044006f, -3.078125f, -13.687500f, -12.773438f, 5.269531f, 5.320312f, -0.205078f, 5.203125f, -18.234375f, 1.648438f, -6.472656f, -4.277344f, 2.216797f, -0.094666f, -1.126953f, -10.890625f, -14.273438f, -11.195312f, 12.718750f, -10.007812f, -0.407227f, -8.937500f, -9.250000f, 9.843750f, 0.242676f, -11.875000f, 3.529297f, -3.119141f, -2.636719f, 27.953125f, -4.757812f, 11.515625f, -0.868652f, -0.487061f, -1.577148f, -12.875000f, -9.664062f, -8.296875f, 16.343750f, -3.892578f, 4.117188f, -8.500000f, -1.601562f, 2.781250f, 24.734375f, -9.218750f, -0.551758f, -4.089844f, -5.433594f, 5.429688f, -3.564453f, -0.053650f, -12.734375f, -2.404297f, -2.839844f, 5.152344f, 3.279297f, 11.695312f, -4.042969f, 1.494141f, -4.636719f, -3.148438f, 9.742188f, 3.615234f, -16.421875f, -7.023438f, 9.343750f, 11.226562f, -8.835938f, 10.789062f, -9.109375f, -12.859375f, 1.666992f, 4.000000f, 12.320312f, 2.041016f, -1.267578f, 25.656250f, -11.640625f, -7.472656f, -1.515625f, 3.882812f, 0.261230f, 4.253906f, -12.562500f, -1.404297f, -0.706543f, -3.833984f, -2.656250f, -4.363281f, 0.877930f, 2.888672f, -2.529297f, -6.152344f, -7.238281f, 3.451172f, -22.187500f, -4.621094f, 18.171875f, 12.195312f, -26.312500f, 3.687500f, -8.593750f, 0.791992f, -6.347656f, 13.742188f, -13.851562f, -8.640625f, -11.343750f, -7.367188f, 4.210938f, 5.199219f, 13.890625f, 0.604980f, -1.551758f, 26.343750f, -3.759766f, -25.828125f }; +static const float16 min_val = -9.328125; +static const float16 max_val = -0.358643; +static const float16 expected[] = { -0.358643f, -0.358643f, -2.808594f, -0.358643f, -0.358643f, -2.402344f, -1.770508f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -2.794922f, -0.358643f, -0.358643f, -5.367188f, -0.358643f, -0.358643f, -0.366943f, -2.781250f, -0.358643f, -5.710938f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.730469f, -0.358643f, -0.358643f, -0.358643f, -7.953125f, -2.646484f, -0.358643f, -0.626465f, -3.564453f, -9.328125f, -9.328125f, -4.976562f, -0.637207f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.458008f, -9.328125f, -0.358643f, -7.156250f, -6.640625f, -5.542969f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -1.016602f, -1.394531f, -0.675781f, -0.872070f, -0.358643f, -1.569336f, -0.358643f, -4.023438f, -2.041016f, -9.328125f, -4.398438f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.462646f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -7.625000f, -9.328125f, -6.218750f, -2.687500f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -6.910156f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -6.203125f, -7.417969f, -9.328125f, -0.358643f, -0.358643f, -2.857422f, -0.358643f, -0.358643f, -0.638184f, -8.093750f, -8.500000f, -0.358643f, -0.358643f, -2.767578f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -2.212891f, -0.358643f, -0.358643f, -0.358643f, -0.456787f, -0.358643f, -3.666016f, -0.358643f, -0.358643f, -8.390625f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.472656f, -0.358643f, -2.917969f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -5.335938f, -0.358643f, -0.358643f, -9.328125f, -5.902344f, -0.358643f, -9.328125f, -9.328125f, -0.414551f, -0.358643f, -0.358643f, -5.855469f, -4.949219f, -9.328125f, -7.359375f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -6.390625f, -6.578125f, -0.358643f, -0.882324f, -0.358643f, -7.132812f, -0.358643f, -7.953125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -6.214844f, -7.144531f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -3.003906f, -1.137695f, -2.757812f, -5.007812f, -4.589844f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -1.334961f, -9.304688f, -9.328125f, -0.358643f, -8.171875f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.785156f, -0.358643f, -1.873047f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -6.980469f, -9.328125f, -1.304688f, -9.328125f, -0.358643f, -9.328125f, -8.804688f, -0.358643f, -0.554688f, -6.117188f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -4.539062f, -9.328125f, -0.358643f, -4.238281f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -1.554688f, -5.195312f, -6.164062f, -9.328125f, -0.358643f, -7.191406f, -0.358643f, -1.295898f, -0.358643f, -0.358643f, -0.358643f, -9.132812f, -0.358643f, -9.328125f, -9.328125f, -4.863281f, -9.328125f, -0.358643f, -4.621094f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -1.147461f, -0.358643f, -0.358643f, -0.358643f, -1.817383f, -5.703125f, -9.328125f, -3.425781f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -6.257812f, -2.062500f, -0.358643f, -1.499023f, -0.358643f, -0.358643f, -0.358643f, -4.023438f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.432617f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.070312f, -9.140625f, -0.358643f, -0.358643f, -0.358643f, -5.585938f, -9.328125f, -6.484375f, -0.358643f, -5.878906f, -8.914062f, -0.358643f, -0.358643f, -0.358643f, -6.652344f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -3.496094f, -6.363281f, -7.062500f, -9.328125f, -6.945312f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -9.328125f, -5.648438f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -4.339844f, -0.358643f, -6.464844f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -8.406250f, -0.358643f, -3.876953f, -0.358643f, -8.453125f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -1.257812f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.511719f, -1.938477f, -0.682617f, -0.805664f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -4.070312f, -0.358643f, -9.328125f, -2.904297f, -0.358643f, -0.358643f, -6.664062f, -0.358643f, -0.638672f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -8.007812f, -0.358643f, -3.539062f, -6.605469f, -3.650391f, -0.358643f, -9.328125f, -0.358643f, -0.960449f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.613281f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -7.593750f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -2.056641f, -9.281250f, -5.886719f, -0.358643f, -9.328125f, -5.875000f, -9.328125f, -1.727539f, -7.105469f, -4.480469f, -0.358643f, -1.218750f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -5.738281f, -0.358643f, -0.358643f, -0.358643f, -4.437500f, -9.328125f, -2.744141f, -0.358643f, -9.328125f, -0.358643f, -4.753906f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.208984f, -0.358643f, -0.358643f, -0.358643f, -3.337891f, -0.358643f, -2.724609f, -0.476318f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -5.046875f, -1.600586f, -0.358643f, -0.358643f, -2.500000f, -6.253906f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.917969f, -9.328125f, -9.328125f, -1.251953f, -0.358643f, -4.789062f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -5.675781f, -9.328125f, -0.358643f, -4.777344f, -0.358643f, -5.113281f, -9.328125f, -8.640625f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.679688f, -0.358643f, -0.358643f, -5.605469f, -9.328125f, -0.358643f, -9.328125f, -5.484375f, -0.358643f, -0.358643f, -7.035156f, -0.358643f, -9.328125f, -1.238281f, -9.328125f, -9.328125f, -7.222656f, -3.974609f, -0.358643f, -7.074219f, -6.445312f, -0.358643f, -2.425781f, -0.358643f, -3.998047f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -4.234375f, -0.358643f, -0.358643f, -4.960938f, -0.358643f, -9.328125f, -9.140625f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.484375f, -0.358643f, -9.328125f, -0.358643f, -2.908203f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.804688f, -0.358643f, -0.358643f, -0.358643f, -7.218750f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -1.008789f, -9.328125f, -9.328125f, -0.358643f, -2.269531f, -2.103516f, -0.542480f, -3.148438f, -4.140625f, -7.164062f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.326172f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -4.980469f, -9.328125f, -2.578125f, -3.662109f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.289062f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.789062f, -5.296875f, -9.328125f, -4.621094f, -0.358643f, -3.169922f, -4.964844f, -0.406006f, -0.358643f, -1.854492f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.828125f, -0.358643f, -0.358643f, -0.358643f, -1.333984f, -0.358643f, -3.009766f, -4.195312f, -0.358643f, -5.488281f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.503906f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -8.585938f, -6.687500f, -9.328125f, -0.358643f, -2.933594f, -6.644531f, -0.358643f, -4.910156f, -9.164062f, -2.101562f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -4.722656f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -8.484375f, -0.358643f, -0.358643f, -9.328125f, -3.718750f, -0.358643f, -7.890625f, -0.358643f, -0.358643f, -4.507812f, -3.591797f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.324219f, -0.358643f, -1.801758f, -0.358643f, -0.358643f, -4.757812f, -0.826660f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.109375f, -0.358643f, -0.358643f, -1.195312f, -0.358643f, -0.358643f, -1.419922f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.012695f, -0.358643f, -0.358643f, -9.156250f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -2.566406f, -9.328125f, -0.991699f, -4.816406f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -6.679688f, -2.837891f, -0.358643f, -0.358643f, -6.066406f, -0.358643f, -0.358643f, -4.351562f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -1.788086f, -0.358643f, -0.358643f, -9.328125f, -8.992188f, -0.358643f, -7.906250f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.095703f, -9.328125f, -2.900391f, -2.419922f, -5.312500f, -0.358643f, -9.328125f, -9.023438f, -9.328125f, -0.358643f, -5.726562f, -0.358643f, -0.358643f, -0.358643f, -7.164062f, -0.358643f, -0.358643f, -0.358643f, -3.275391f, -2.462891f, -0.358643f, -2.212891f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -1.268555f, -0.358643f, -0.358643f, -5.769531f, -0.358643f, -4.023438f, -9.328125f, -9.328125f, -7.367188f, -0.358643f, -0.435547f, -9.328125f, -8.664062f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -7.468750f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -4.363281f, -0.358643f, -0.358643f, -1.734375f, -0.358643f, -0.358643f, -5.628906f, -0.358643f, -2.798828f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -3.564453f, -0.358643f, -0.358643f, -0.358643f, -4.613281f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -4.453125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -3.437500f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.429688f, -0.469971f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.766113f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -8.710938f, -0.570801f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -8.476562f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -5.160156f, -9.328125f, -0.358643f, -8.789062f, -0.429443f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.972656f, -1.533203f, -0.380859f, -5.585938f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -1.147461f, -0.358643f, -0.358643f, -5.851562f, -9.328125f, -4.414062f, -0.358643f, -9.328125f, -1.142578f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.152344f, -0.589355f, -0.358643f, -0.358643f, -0.407471f, -1.727539f, -9.328125f, -9.164062f, -0.358643f, -0.358643f, -0.358643f, -2.287109f, -0.358643f, -7.625000f, -9.328125f, -5.144531f, -6.070312f, -1.679688f, -0.358643f, -9.000000f, -0.358643f, -6.660156f, -1.754883f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -2.464844f, -0.358643f, -0.358643f, -2.457031f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -8.789062f, -4.289062f, -9.328125f, -0.358643f, -6.203125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -2.970703f, -0.358643f, -0.358643f, -0.438232f, -5.808594f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.896484f, -9.328125f, -0.358643f, -0.358643f, -3.150391f, -9.328125f, -0.358643f, -1.725586f, -4.226562f, -6.148438f, -0.358643f, -2.324219f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.362549f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -6.746094f, -0.358643f, -0.358643f, -5.699219f, -4.238281f, -0.358643f, -0.358643f, -2.492188f, -0.358643f, -5.500000f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -4.988281f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -2.029297f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -4.664062f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -7.148438f, -0.971680f, -0.358643f, -1.369141f, -0.358643f, -8.773438f, -5.347656f, -4.972656f, -0.358643f, -0.358643f, -0.358643f, -1.668945f, -0.595215f, -0.358643f, -5.796875f, -0.358643f, -3.132812f, -0.358643f, -9.328125f, -0.358643f, -0.906250f, -9.328125f, -0.358643f, -6.761719f, -0.615234f, -9.328125f, -3.970703f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.954102f, -1.468750f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -3.796875f, -1.178711f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -6.519531f, -9.328125f, -0.358643f, -9.328125f, -1.863281f, -0.358643f, -9.328125f, -0.358643f, -7.761719f, -5.175781f, -0.358643f, -4.843750f, -0.358643f, -0.358643f, -1.625000f, -1.651367f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -8.585938f, -0.358643f, -9.328125f, -9.070312f, -9.328125f, -0.358643f, -0.358643f, -2.630859f, -0.358643f, -0.358643f, -0.358643f, -9.039062f, -9.328125f, -0.358643f, -0.358643f, -3.517578f, -0.358643f, -0.358643f, -0.358643f, -3.369141f, -0.565430f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -6.687500f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -1.067383f, -0.358643f, -4.054688f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -7.554688f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -1.505859f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.238281f, -5.339844f, -5.820312f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.457031f, -3.884766f, -0.358643f, -0.358643f, -0.358643f, -4.050781f, -0.358643f, -2.394531f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -6.925781f, -5.042969f, -0.358643f, -0.358643f, -7.031250f, -0.358643f, -0.358643f, -2.888672f, -0.358643f, -7.648438f, -0.358643f, -0.358643f, -6.085938f, -0.358643f, -0.358643f, -6.574219f, -6.128906f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -1.315430f, -0.358643f, -9.328125f, -7.296875f, -0.358643f, -0.358643f, -0.358643f, -8.578125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.144531f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -3.433594f, -9.257812f, -4.414062f, -4.804688f, -1.407227f, -1.355469f, -9.328125f, -0.401123f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -1.982422f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -4.746094f, -4.652344f, -4.042969f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -4.503906f, -2.902344f, -1.708008f, -3.849609f, -8.171875f, -0.358643f, -5.707031f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -3.224609f, -9.328125f, -9.328125f, -5.171875f, -0.358643f, -1.185547f, -9.281250f, -9.328125f, -9.328125f, -0.358643f, -2.423828f, -0.358643f, -4.648438f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -3.095703f, -3.373047f, -0.358643f, -6.039062f, -0.358643f, -5.570312f, -6.941406f, -6.914062f, -0.615234f, -0.358643f, -0.358643f, -8.531250f, -2.779297f, -7.355469f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -8.234375f, -6.988281f, -0.358643f, -5.171875f, -0.358643f, -0.358643f, -3.447266f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.269531f, -0.505859f, -0.358643f, -3.886719f, -3.345703f, -4.042969f, -0.747070f, -9.328125f, -0.358643f, -0.358643f, -5.957031f, -4.675781f, -0.358643f, -2.078125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -3.910156f, -0.358643f, -4.445312f, -0.358643f, -3.587891f, -0.358643f, -3.814453f, -9.328125f, -0.358643f, -0.358643f, -1.489258f, -0.358643f, -0.358643f, -0.358643f, -5.050781f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.451416f, -6.800781f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.763184f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -7.187500f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -8.515625f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -5.250000f, -9.328125f, -0.358643f, -8.539062f, -6.355469f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -4.312500f, -0.358643f, -0.358643f, -1.838867f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.802246f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -5.171875f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -1.155273f, -1.240234f, -0.358643f, -0.358643f, -2.833984f, -1.505859f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.683105f, -4.035156f, -9.328125f, -7.167969f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.468750f, -1.955078f, -0.358643f, -0.358643f, -4.242188f, -9.328125f, -2.976562f, -3.632812f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -7.359375f, -0.358643f, -8.976562f, -0.358643f, -9.328125f, -6.738281f, -0.358643f, -0.358643f, -7.308594f, -0.358643f, -9.328125f, -9.328125f, -7.195312f, -7.777344f, -5.457031f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -2.482422f, -9.328125f, -0.358643f, -0.358643f, -3.849609f, -0.358643f, -0.358643f, -7.476562f, -0.965332f, -3.310547f, -0.358643f, -0.358643f, -9.328125f, -3.699219f, -5.945312f, -0.358643f, -6.675781f, -9.328125f, -0.358643f, -0.670898f, -9.328125f, -0.916016f, -5.953125f, -9.328125f, -0.358643f, -7.296875f, -0.358643f, -5.886719f, -0.358643f, -8.429688f, -0.358643f, -0.358643f, -0.564941f, -6.109375f, -9.328125f, -7.046875f, -0.358643f, -0.358643f, -0.358643f, -5.160156f, -1.670898f, -9.304688f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -2.705078f, -2.398438f, -2.222656f, -0.358643f, -4.882812f, -4.640625f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.367188f, -9.328125f, -9.328125f, -0.358643f, -4.746094f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -8.500000f, -1.680664f, -0.358643f, -5.363281f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -1.259766f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -5.179688f, -9.328125f, -0.358643f, -5.953125f, -9.328125f, -1.941406f, -1.483398f, -0.358643f, -7.984375f, -0.358643f, -0.358643f, -9.328125f, -1.731445f, -0.358643f, -4.031250f, -0.358643f, -2.994141f, -5.429688f, -1.330078f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.422119f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -6.773438f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -4.296875f, -5.800781f, -0.358643f, -6.667969f, -0.358643f, -7.125000f, -0.358643f, -8.312500f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -4.039062f, -3.585938f, -7.167969f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.645508f, -9.328125f, -0.358643f, -1.397461f, -9.328125f, -0.358643f, -9.210938f, -0.358643f, -6.613281f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -4.953125f, -2.052734f, -0.358643f, -3.146484f, -9.328125f, -0.649902f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -4.054688f, -5.128906f, -0.358643f, -8.476562f, -5.601562f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -3.156250f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -3.406250f, -0.358643f, -9.328125f, -1.005859f, -6.304688f, -7.046875f, -0.358643f, -0.953125f, -0.358643f, -0.358643f, -6.960938f, -6.980469f, -2.804688f, -0.358643f, -9.328125f, -0.358643f, -5.496094f, -9.328125f, -8.625000f, -0.358643f, -5.179688f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -9.062500f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -7.769531f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -4.242188f, -1.308594f, -0.358643f, -2.158203f, -0.358643f, -5.136719f, -0.358643f, -0.358643f, -4.601562f, -2.976562f, -0.358643f, -0.358643f, -6.769531f, -0.358643f, -0.358643f, -2.990234f, -4.875000f, -8.187500f, -0.358643f, -0.358643f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -3.441406f, -9.328125f, -0.358643f, -6.265625f, -8.890625f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.046875f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -0.825684f, -0.358643f, -9.328125f, -2.675781f, -0.358643f, -1.788086f, -7.410156f, -0.358643f, -9.328125f, -9.328125f, -6.550781f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -4.359375f, -0.358643f, -0.358643f, -5.406250f, -7.335938f, -0.358643f, -9.328125f, -1.004883f, -9.328125f, -0.358643f, -2.605469f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -9.328125f, -0.358643f, -0.358643f, -8.671875f, -0.358643f, -0.358643f, -3.078125f, -9.328125f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -6.472656f, -4.277344f, -0.358643f, -0.358643f, -1.126953f, -9.328125f, -9.328125f, -9.328125f, -0.358643f, -9.328125f, -0.407227f, -8.937500f, -9.250000f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -3.119141f, -2.636719f, -0.358643f, -4.757812f, -0.358643f, -0.868652f, -0.487061f, -1.577148f, -9.328125f, -9.328125f, -8.296875f, -0.358643f, -3.892578f, -0.358643f, -8.500000f, -1.601562f, -0.358643f, -0.358643f, -9.218750f, -0.551758f, -4.089844f, -5.433594f, -0.358643f, -3.564453f, -0.358643f, -9.328125f, -2.404297f, -2.839844f, -0.358643f, -0.358643f, -0.358643f, -4.042969f, -0.358643f, -4.636719f, -3.148438f, -0.358643f, -0.358643f, -9.328125f, -7.023438f, -0.358643f, -0.358643f, -8.835938f, -0.358643f, -9.109375f, -9.328125f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.267578f, -0.358643f, -9.328125f, -7.472656f, -1.515625f, -0.358643f, -0.358643f, -0.358643f, -9.328125f, -1.404297f, -0.706543f, -3.833984f, -2.656250f, -4.363281f, -0.358643f, -0.358643f, -2.529297f, -6.152344f, -7.238281f, -0.358643f, -9.328125f, -4.621094f, -0.358643f, -0.358643f, -9.328125f, -0.358643f, -8.593750f, -0.358643f, -6.347656f, -0.358643f, -9.328125f, -8.640625f, -9.328125f, -7.367188f, -0.358643f, -0.358643f, -0.358643f, -0.358643f, -1.551758f, -0.358643f, -3.759766f, -9.328125f }; + +#endif /* DATA_H_ */ diff --git a/tests/spatz_on_magia/onnx_clip/test_data/generator.py b/tests/spatz_on_magia/onnx_clip/test_data/generator.py new file mode 100644 index 00000000..4043b459 --- /dev/null +++ b/tests/spatz_on_magia/onnx_clip/test_data/generator.py @@ -0,0 +1,89 @@ +import os +import sys +import numpy as np +import onnx +import onnxruntime as ort +from onnx import helper, TensorProto + +def parse_args(): + if len(sys.argv) != 2: + print("Error: missing argument ") + print("Usage: python3 generator.py ") + sys.exit(1) + + try: + length = int(sys.argv[1]) + except ValueError: + print("Error: must be an integer") + print("Usage: python3 generator.py ") + sys.exit(1) + + return length + +def generate_data(length): + vals = (np.random.randn(2) * 5).astype(np.float16) + val_min = np.array([np.min(vals)], dtype=np.float16) + val_max = np.array([np.max(vals)], dtype=np.float16) + + a = (np.random.randn(length) * 10).astype(np.float16) + + return a, val_min, val_max + +def run_onnx_clip(input_vec, val_min, val_max): + a_info = helper.make_tensor_value_info('A', TensorProto.FLOAT16, input_vec.shape) + min_info = helper.make_tensor_value_info('Min', TensorProto.FLOAT16, val_min.shape) + max_info = helper.make_tensor_value_info('Max', TensorProto.FLOAT16, val_max.shape) + out_info = helper.make_tensor_value_info('Output', TensorProto.FLOAT16, input_vec.shape) + + node_def = helper.make_node('Clip', ['A', 'Min', 'Max'], ['Output']) + graph_def = helper.make_graph( + [node_def], + 'onnx-clip-test', + [a_info, min_info, max_info], + [out_info] + ) + + model_def = helper.make_model(graph_def, producer_name='onnx-generator') + sess = ort.InferenceSession(model_def.SerializeToString()) + res = sess.run(None, {'A': input_vec, 'Min': val_min, 'Max': val_max}) + + return res[0] + +def format_array(array): + return "{ " + ", ".join(f"{x:f}f" for x in array) + " }" + +def format_float(value): + """Convert a float value into a C-style representation.""" + return f"{value:f}" + +def generate_header_file(length, input_vec, min, max, expected, filename="data.h"): + + script_dir = os.path.dirname(os.path.abspath(__file__)) + filepath = os.path.join(script_dir, filename) + + with open(filepath, "w") as f: + f.write("/* Automatically generated header file for Spatz ONNX testing */\n") + f.write("#ifndef DATA_H_\n") + f.write("#define DATA_H_\n\n") + + f.write(f"#define LEN {length}\n\n") + + f.write(f"static const float16 input_vec[] = {format_array(input_vec)};\n") + f.write(f"static const float16 min_val = {format_float(min.item())};\n") + f.write(f"static const float16 max_val = {format_float(max.item())};\n") + f.write(f"static const float16 expected[] = {format_array(expected)};\n\n") + + f.write("#endif /* DATA_H_ */\n") + +def main(): + length = parse_args() + + input, min, max = generate_data(length) + expected = run_onnx_clip(input, min, max) + + generate_header_file(length, input, min, max, expected) + + print(f"File 'data.h' successfully generated with {length} elements.") + +if __name__ == "__main__": + main() diff --git a/tests/spatz_on_magia/onnx_div/CMakeLists.txt b/tests/spatz_on_magia/onnx_div/CMakeLists.txt new file mode 100644 index 00000000..1f597123 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/CMakeLists.txt @@ -0,0 +1,20 @@ +set(TEST_NAME onnx_div) + +# Compile Spatz task +add_spatz_task( + TEST_NAME ${TEST_NAME} + TASK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spatz_task/onnx_div_task.c + FIRST_TASK_NAME onnx_div_task + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# Compile CV32 executable with embedded Spatz binary +add_cv32_executable_with_spatz( + TARGET_NAME ${TEST_NAME} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.c + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ${CMAKE_CURRENT_SOURCE_DIR}/include +) diff --git a/tests/spatz_on_magia/onnx_div/include/onnx_div_mem_layout.h b/tests/spatz_on_magia/onnx_div/include/onnx_div_mem_layout.h new file mode 100644 index 00000000..3db9e030 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/include/onnx_div_mem_layout.h @@ -0,0 +1,31 @@ +#ifndef ONNX_DIV_H_ +#define ONNX_DIV_H_ + +#include "data.h" +#include "magia_tile_utils.h" +#include "magia_utils.h" +#include "onnx_div_params.h" + +#define ALIGNMENT 4 +/* Aligns the given address to 4-byte */ +#define ALIGN_4B(addr) (((addr) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)) + +#define L1_BASE_TILE (L1_BASE + (get_hartid() * L1_TILE_OFFSET)) +#define VEC_SIZE (LEN * sizeof(float16)) + +#define ONNX_DIV_PARAMS_BASE L1_BASE_TILE +#define ONNX_DIV_PARAMS_SIZE ALIGN_4B(sizeof(onnx_div_params_t)) + +#define SRC_A_BASE ALIGN_4B(ONNX_DIV_PARAMS_BASE + ONNX_DIV_PARAMS_SIZE) +#define SRC_A_SIZE ALIGN_4B(VEC_SIZE) + +#define SRC_B_BASE ALIGN_4B(SRC_A_BASE + SRC_A_SIZE) +#define SRC_B_SIZE ALIGN_4B(VEC_SIZE) + +#define RES_BASE ALIGN_4B(SRC_B_BASE + SRC_B_SIZE) +#define RES_SIZE ALIGN_4B(VEC_SIZE) + +#define EXP_BASE ALIGN_4B(RES_BASE + RES_SIZE) +#define EXP_SIZE ALIGN_4B(VEC_SIZE) + +#endif /* ONNX_DIV_H_ */ diff --git a/tests/spatz_on_magia/onnx_div/include/onnx_div_params.h b/tests/spatz_on_magia/onnx_div/include/onnx_div_params.h new file mode 100644 index 00000000..24fe4007 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/include/onnx_div_params.h @@ -0,0 +1,14 @@ +#ifndef ONNX_DIV_PARAMS_H_ +#define ONNX_DIV_PARAMS_H_ + +#include + +typedef struct { + uintptr_t addr_res; + uintptr_t addr_exp; + uintptr_t addr_a; + uintptr_t addr_b; + uint32_t len; +} onnx_div_params_t; + +#endif /* ONNX_DIV_PARAMS_H_ */ diff --git a/tests/spatz_on_magia/onnx_div/main.c b/tests/spatz_on_magia/onnx_div/main.c new file mode 100644 index 00000000..584c1803 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/main.c @@ -0,0 +1,109 @@ +#include "tile.h" +#include "eventunit.h" + +#include "compare_utils.h" +#include "data.h" +#include "onnx_div_mem_layout.h" +#include "onnx_div_params.h" +#include "onnx_div_task_bin.h" + +static int init_data(void *params) +{ + uint32_t offset; + volatile onnx_div_params_t *div_params; + + div_params = (volatile onnx_div_params_t *) params; + for (int i = 0; i < LEN; i++) { + offset = i * sizeof(float16); + + mmio_fp16(EXP_BASE + offset) = expected[i]; + mmio_fp16(SRC_A_BASE + offset) = vec_a[i]; + mmio_fp16(SRC_B_BASE + offset) = vec_b[i]; + mmio_fp16(RES_BASE + offset) = 0; + } + + div_params->addr_a = SRC_A_BASE; + div_params->addr_b = SRC_B_BASE; + div_params->addr_res = RES_BASE; + div_params->addr_exp = EXP_BASE; + div_params->len = LEN; + + return 0; +} + +static int run_spatz_task() +{ + int ret; + eu_config_t eu_cfg; + eu_controller_t eu_ctrl; + + eu_cfg.hartid = get_hartid(); + eu_ctrl.base = NULL, + eu_ctrl.cfg = &eu_cfg, + eu_ctrl.api = &eu_api, + + eu_init(&eu_ctrl); + eu_spatz_init(&eu_ctrl, 0); + + spatz_init(SPATZ_BINARY_START); + spatz_run_task_with_params(ONNX_DIV_TASK, ONNX_DIV_PARAMS_BASE); + + eu_spatz_wait(&eu_ctrl, WFE); + + ret = spatz_get_exit_code(); + + spatz_clk_dis(); + + return ret; +} + +static bool check_result(void *params) +{ + volatile onnx_div_params_t *div_params; + div_params = (volatile onnx_div_params_t *) params; + return vector_compare_fp16_bitwise(div_params->addr_res, div_params->addr_exp, div_params->len); +} + +static bool run_test() +{ + int ret; + bool check; + volatile onnx_div_params_t *params; + + params = (volatile onnx_div_params_t *) ONNX_DIV_PARAMS_BASE; + + ret = init_data(params); + if (ret != 0) { + printf("[CV32] Params initialization failed with error: %d\n", ret); + return ret; + } + + ret = run_spatz_task(); + if (ret != 0) { + printf("[CV32] Spatz task FAILED with error: %d", ret); + return ret; + } + + check = check_result(params); + if (check) { + printf("[CV32] Test SUCCESS\n"); + } else { + printf("[CV32] Test FAILED\n"); + ret = -1; + } + + return ret; +} + +int main(void) +{ + int ret; + + printf("\n##################################### ONNX_DIV TEST #####################################\n\n"); + + ret = run_test(); + + printf("\n##########################################################################################\n\n"); + + return ret; +} diff --git a/tests/spatz_on_magia/onnx_div/spatz_task/onnx_div_task.c b/tests/spatz_on_magia/onnx_div/spatz_task/onnx_div_task.c new file mode 100644 index 00000000..c269e75b --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/spatz_task/onnx_div_task.c @@ -0,0 +1,38 @@ +#include "tile.h" +#include "onnx_div_params.h" + +int onnx_div_task(void) +{ + volatile onnx_div_params_t *params; + uintptr_t params_addr; + _Float16 *a; + _Float16 *b; + _Float16 *r; + size_t avl; + size_t vl; + + params_addr = mmio32(SPATZ_DATA); + params = (volatile onnx_div_params_t *) params_addr; + + r = (_Float16 *)params->addr_res; + a = (_Float16 *)params->addr_a; + b = (_Float16 *)params->addr_b; + avl = params->len; + + for (; avl > 0; avl -= vl) { + asm volatile ("vsetvli %0, %1, e16, m8, ta, ma" : "=r"(vl) : "r"(avl)); + + asm volatile ("vle16.v v0, (%0)" :: "r"(a)); + asm volatile ("vle16.v v8, (%0)" :: "r"(b)); + + asm volatile ("vfdiv.vv v16, v0, v8"); + + asm volatile ("vse16.v v16, (%0)" :: "r"(r)); + + a += vl; + b += vl; + r += vl; + } + + return 0; +} diff --git a/tests/spatz_on_magia/onnx_div/test_data/data.h b/tests/spatz_on_magia/onnx_div/test_data/data.h new file mode 100644 index 00000000..f709ff16 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/test_data/data.h @@ -0,0 +1,11 @@ +/* Automatically generated header file for Spatz ONNX testing */ +#ifndef DATA_H_ +#define DATA_H_ + +#define LEN 2048 + +static const float16 vec_a[] = { 13.375000f, 12.640625f, -7.101562f, 1.538086f, 0.739746f, 4.250000f, -5.000000f, -3.652344f, -2.320312f, 8.109375f, 13.507812f, 8.367188f, -6.031250f, 7.761719f, 12.109375f, 12.664062f, -10.070312f, -9.406250f, 3.363281f, 18.218750f, 6.035156f, -1.087891f, 15.851562f, 1.745117f, 18.062500f, 5.625000f, -17.859375f, -5.734375f, 3.966797f, -6.683594f, -8.617188f, -11.125000f, 0.708984f, -8.296875f, -13.734375f, -4.277344f, -16.140625f, -7.031250f, 2.183594f, 2.525391f, -7.656250f, 2.076172f, -0.684570f, 0.437500f, -5.640625f, 22.828125f, 13.367188f, 13.000000f, -6.863281f, -3.158203f, -11.898438f, -4.812500f, -8.554688f, -4.562500f, -6.222656f, 5.539062f, 8.460938f, -13.718750f, 5.738281f, 10.414062f, 1.543945f, -16.390625f, -2.914062f, -9.796875f, -6.402344f, 7.238281f, -12.296875f, -1.791992f, 1.468750f, 16.843750f, -15.367188f, 2.865234f, -9.078125f, -1.943359f, 6.863281f, 0.167480f, -3.408203f, -2.458984f, -25.000000f, 10.851562f, -13.898438f, -4.246094f, -5.625000f, -14.273438f, 7.449219f, 4.300781f, 16.187500f, -7.003906f, -6.765625f, 9.007812f, -6.800781f, 1.050781f, 1.951172f, -17.906250f, 1.378906f, 8.687500f, -4.972656f, 5.273438f, -18.781250f, -1.076172f, -21.000000f, -1.599609f, -6.140625f, -15.226562f, -14.250000f, -5.945312f, -15.414062f, 19.718750f, -0.470459f, -8.226562f, -16.625000f, -6.222656f, 12.320312f, -1.435547f, 5.964844f, 5.554688f, -9.835938f, 9.273438f, 14.937500f, 8.687500f, -6.812500f, -0.137573f, 7.699219f, -0.018005f, -10.875000f, -0.012680f, -14.203125f, 3.005859f, 4.683594f, 16.781250f, -6.367188f, 3.470703f, -2.630859f, 6.835938f, -0.931152f, -15.617188f, -4.871094f, 0.866211f, 2.562500f, -2.066406f, -7.046875f, 8.937500f, 22.250000f, -7.460938f, -0.099426f, 18.218750f, -0.967285f, 0.076538f, 3.392578f, 18.046875f, 6.460938f, 9.085938f, -2.583984f, 8.414062f, -18.890625f, 3.873047f, -9.953125f, -0.754395f, 10.359375f, 6.226562f, -2.216797f, 5.945312f, -0.942383f, 5.226562f, -4.390625f, 6.511719f, 7.679688f, -14.593750f, -10.843750f, -12.343750f, 1.383789f, 1.241211f, -1.405273f, -25.921875f, 3.173828f, -7.199219f, 3.925781f, -34.375000f, -12.007812f, -15.429688f, 15.328125f, -10.617188f, 11.437500f, -4.492188f, -6.449219f, -9.593750f, 1.816406f, 2.824219f, 13.796875f, -0.421143f, 5.425781f, 6.523438f, 7.433594f, 2.224609f, -11.414062f, -16.453125f, 8.765625f, 10.117188f, 10.570312f, 7.273438f, -19.750000f, -10.281250f, -6.292969f, -9.320312f, 12.429688f, 6.976562f, -1.887695f, -16.109375f, 12.101562f, 16.125000f, 15.945312f, -4.515625f, -2.087891f, 16.296875f, 11.406250f, 4.058594f, 11.867188f, 10.414062f, 13.898438f, -14.578125f, -1.620117f, -7.429688f, -2.806641f, -1.946289f, -8.898438f, 4.835938f, 7.183594f, 1.278320f, 6.066406f, -2.500000f, -10.601562f, -12.671875f, 13.968750f, -10.468750f, 0.810059f, 19.421875f, -7.937500f, 6.285156f, -6.375000f, 14.304688f, -0.866699f, -2.494141f, 11.476562f, 10.875000f, -5.738281f, 4.066406f, -6.093750f, 7.582031f, -10.656250f, -9.351562f, -2.119141f, 0.334961f, -8.062500f, -9.789062f, -18.437500f, 8.820312f, 18.109375f, 1.313477f, 3.988281f, 9.617188f, 17.781250f, -7.101562f, -3.804688f, 16.296875f, 9.320312f, -2.781250f, -8.226562f, 11.031250f, 7.507812f, 7.070312f, 5.519531f, -0.426025f, -1.387695f, -3.466797f, -18.156250f, 1.342773f, -11.515625f, 20.031250f, -2.519531f, 8.171875f, -12.406250f, -15.968750f, -1.495117f, -3.957031f, 3.310547f, 10.937500f, 5.253906f, -10.789062f, -2.751953f, -0.229858f, 17.734375f, -6.402344f, -8.000000f, 15.937500f, -2.857422f, 13.617188f, -27.453125f, -0.712891f, 3.246094f, 15.390625f, 9.476562f, 6.851562f, -8.429688f, 6.960938f, 4.617188f, -1.795898f, -6.062500f, 5.644531f, -4.812500f, 18.250000f, -2.115234f, 8.734375f, 18.265625f, -7.507812f, -3.253906f, 0.384766f, 10.859375f, 0.836914f, -10.046875f, -0.708008f, 7.195312f, 0.480713f, 14.140625f, 5.449219f, 14.578125f, 8.539062f, -2.007812f, -8.953125f, -13.695312f, -14.570312f, 3.269531f, -0.106750f, -12.773438f, 11.484375f, 0.624023f, 3.505859f, -21.734375f, 4.328125f, -8.921875f, 7.156250f, 9.703125f, 9.867188f, 18.921875f, -1.944336f, 0.431885f, 13.367188f, 1.660156f, 2.460938f, 5.449219f, 3.886719f, -17.687500f, -2.130859f, 18.609375f, -15.890625f, -7.136719f, 1.945312f, -0.704590f, -4.687500f, 3.849609f, 2.507812f, 5.941406f, 5.691406f, 4.652344f, 0.396484f, -3.310547f, -15.562500f, 3.062500f, 2.500000f, -12.789062f, -12.906250f, 11.687500f, 3.976562f, -8.984375f, 20.093750f, -17.359375f, 7.777344f, -1.104492f, -3.755859f, 12.820312f, -9.398438f, -0.575195f, -12.500000f, 1.647461f, -1.597656f, -7.562500f, -13.421875f, -15.070312f, -7.261719f, -10.078125f, 23.125000f, 23.765625f, 0.197632f, -8.273438f, 6.449219f, -13.507812f, -3.759766f, 13.960938f, 21.312500f, 19.859375f, 0.919434f, -9.351562f, 12.468750f, -0.870605f, -2.886719f, 1.153320f, -7.878906f, 2.001953f, 0.727539f, 2.474609f, -5.574219f, 13.898438f, -4.453125f, -3.257812f, 17.437500f, 12.351562f, 15.484375f, -10.070312f, -12.359375f, -1.338867f, -10.343750f, 1.244141f, -13.132812f, -2.820312f, -2.027344f, -1.280273f, 0.211792f, -4.347656f, 1.772461f, 2.197266f, 2.144531f, -2.332031f, 0.341309f, 1.862305f, -8.585938f, -8.296875f, -9.492188f, 6.972656f, -6.304688f, -11.570312f, -17.890625f, 11.437500f, -0.193115f, -2.535156f, -13.718750f, -17.531250f, -7.488281f, 14.640625f, 12.968750f, -3.357422f, -18.968750f, -2.439453f, -5.953125f, -8.070312f, -8.125000f, -1.274414f, 5.527344f, 7.417969f, 1.231445f, 13.765625f, 5.113281f, -1.682617f, -14.812500f, -13.484375f, 9.843750f, 14.226562f, 3.039062f, -10.882812f, -11.343750f, 1.583984f, 6.683594f, -2.921875f, 0.780273f, 6.351562f, 4.917969f, 1.808594f, 21.531250f, -3.777344f, 19.046875f, 4.363281f, 7.691406f, 3.859375f, -10.765625f, 9.085938f, 2.248047f, 0.214600f, -7.902344f, -5.347656f, 20.265625f, -4.328125f, -0.634277f, 14.757812f, -15.718750f, 0.025803f, 15.406250f, -12.093750f, -13.765625f, -9.320312f, 4.230469f, 5.757812f, -7.105469f, -11.648438f, -6.648438f, 16.046875f, 13.523438f, 13.046875f, 6.074219f, 3.857422f, -16.656250f, 4.375000f, 13.296875f, 7.875000f, 15.531250f, -2.003906f, 10.976562f, -7.382812f, -2.689453f, -1.261719f, -10.335938f, 17.406250f, 3.789062f, 1.991211f, 14.617188f, 4.261719f, 6.414062f, -1.912109f, 1.611328f, -10.359375f, -19.031250f, -3.443359f, 1.792969f, -5.167969f, -1.970703f, -6.781250f, 3.115234f, -6.371094f, -4.242188f, -20.125000f, 20.859375f, -10.039062f, -7.875000f, -15.515625f, -3.580078f, -13.148438f, -6.445312f, -0.592773f, 10.945312f, -13.242188f, -3.701172f, 8.468750f, -9.132812f, -19.625000f, 13.945312f, -2.281250f, -14.773438f, -15.671875f, 6.585938f, -18.593750f, 15.156250f, 17.031250f, -1.169922f, 2.232422f, -3.814453f, 3.822266f, -13.015625f, -1.654297f, 10.429688f, -11.187500f, 1.670898f, -1.543945f, 10.062500f, 2.798828f, -6.070312f, -15.437500f, -13.593750f, 3.380859f, -23.062500f, 1.964844f, -1.111328f, 5.597656f, -21.593750f, -33.218750f, 0.822754f, -0.697754f, -2.482422f, -14.210938f, 1.055664f, 19.937500f, 7.066406f, 0.019470f, 5.164062f, 9.914062f, 3.078125f, 8.000000f, -20.203125f, -1.555664f, -5.078125f, 5.371094f, 18.859375f, -2.283203f, -2.652344f, -11.859375f, -11.289062f, 3.058594f, 7.332031f, 3.744141f, 8.812500f, 2.111328f, 4.058594f, -4.437500f, -6.410156f, -22.640625f, -23.062500f, -1.119141f, -3.310547f, -3.330078f, 10.726562f, -10.492188f, -6.054688f, -2.941406f, -15.367188f, 2.066406f, -16.687500f, 5.339844f, -15.109375f, -7.441406f, -7.000000f, 2.546875f, 10.367188f, -5.601562f, 12.117188f, -9.312500f, 9.070312f, -1.901367f, -1.027344f, 2.931641f, -3.816406f, 1.923828f, 5.796875f, 6.968750f, 7.660156f, -0.179199f, 16.000000f, 3.111328f, 5.277344f, 9.328125f, 2.898438f, 4.968750f, 4.808594f, -1.181641f, 7.097656f, 12.710938f, -7.339844f, 7.171875f, -8.054688f, -0.069458f, -6.058594f, -3.068359f, 4.218750f, 14.085938f, 2.814453f, -0.021255f, -7.750000f, -6.734375f, 4.812500f, 7.867188f, 4.144531f, 4.175781f, -15.406250f, 9.468750f, -20.953125f, -1.560547f, -8.781250f, -21.437500f, 4.562500f, 20.437500f, -1.975586f, 22.046875f, -6.078125f, -7.773438f, -9.015625f, -2.800781f, -0.023697f, -4.664062f, -13.867188f, -15.234375f, -0.790039f, 8.429688f, 5.054688f, -2.527344f, 3.365234f, -17.140625f, -7.476562f, 24.140625f, 14.632812f, -5.640625f, -12.492188f, 25.140625f, 1.019531f, 2.412109f, -10.789062f, 13.000000f, -13.250000f, -2.220703f, 10.218750f, -3.482422f, 2.232422f, 5.347656f, -26.984375f, -9.156250f, 0.873535f, 10.820312f, 0.979980f, -7.035156f, 4.632812f, -8.039062f, -3.267578f, -5.855469f, -19.406250f, 0.443848f, 12.625000f, 5.714844f, 9.000000f, -15.070312f, 8.835938f, -2.746094f, -5.933594f, 3.494141f, -10.070312f, -9.109375f, 18.671875f, 9.687500f, -6.726562f, -14.257812f, 12.539062f, 12.914062f, -11.960938f, 6.113281f, 8.992188f, -10.625000f, -1.656250f, 2.802734f, -0.249023f, 2.904297f, 9.796875f, 1.746094f, 12.375000f, 7.292969f, 4.207031f, -3.812500f, -2.988281f, 2.574219f, -27.718750f, 3.791016f, -0.817871f, -14.500000f, 18.406250f, -12.601562f, -10.195312f, 3.183594f, 6.472656f, 14.789062f, 5.242188f, -3.550781f, -4.695312f, -13.796875f, -7.117188f, 12.335938f, -10.375000f, -3.177734f, -6.046875f, 8.281250f, -13.039062f, -3.093750f, 27.218750f, 2.214844f, -2.009766f, -0.225708f, -8.570312f, -2.769531f, -13.578125f, -6.976562f, -35.375000f, -2.353516f, -11.007812f, 20.484375f, 11.515625f, -6.304688f, 6.585938f, 1.870117f, -11.406250f, 6.832031f, -7.929688f, 12.523438f, 14.789062f, 18.312500f, -8.867188f, 14.320312f, 15.125000f, 17.109375f, 0.556152f, -16.218750f, 7.410156f, 6.113281f, 0.166992f, -13.328125f, -5.640625f, 3.542969f, -5.824219f, -7.277344f, 5.210938f, -3.054688f, -2.611328f, -10.515625f, -16.406250f, -5.222656f, -9.648438f, 10.960938f, 10.390625f, 5.628906f, -3.738281f, 17.375000f, 6.285156f, -15.679688f, -1.489258f, 15.234375f, 13.687500f, -5.476562f, -27.312500f, 2.580078f, -0.081787f, -2.230469f, -3.052734f, -2.240234f, 2.593750f, 3.083984f, 3.566406f, -14.382812f, -3.664062f, -26.109375f, -14.562500f, -8.304688f, -2.972656f, -12.687500f, -1.711914f, -3.550781f, -1.784180f, -7.429688f, 2.914062f, -13.289062f, -14.312500f, 21.312500f, 7.140625f, -8.921875f, 0.952148f, -7.945312f, 14.804688f, -13.500000f, 1.321289f, -14.921875f, 18.984375f, 8.429688f, 11.148438f, 14.484375f, 5.582031f, 5.945312f, -6.664062f, -5.546875f, -3.060547f, 7.546875f, 2.855469f, 8.523438f, -1.766602f, -0.687012f, 6.042969f, -10.109375f, -19.953125f, 4.625000f, 2.376953f, 3.015625f, 10.585938f, 16.953125f, 1.773438f, 10.078125f, 9.195312f, 5.226562f, -10.664062f, 1.516602f, 8.375000f, -6.234375f, -14.062500f, -1.080078f, -16.343750f, -5.425781f, -11.734375f, 2.439453f, 6.328125f, -0.404297f, 17.484375f, -1.832031f, 23.296875f, 1.720703f, 21.046875f, -17.531250f, 13.328125f, -4.144531f, 6.003906f, 2.767578f, 4.277344f, -0.564453f, 9.046875f, 6.273438f, 22.453125f, 4.031250f, 1.722656f, 1.125977f, -3.867188f, -11.578125f, -0.296631f, 3.500000f, -18.953125f, 0.452393f, 11.210938f, -4.617188f, 4.968750f, -6.304688f, 6.527344f, -4.113281f, 7.523438f, -21.593750f, -2.742188f, -15.539062f, 11.773438f, 3.994141f, 8.000000f, -6.343750f, 0.225464f, 22.406250f, 8.101562f, 9.734375f, 8.226562f, -1.659180f, -7.238281f, 16.671875f, 6.488281f, -9.710938f, -0.755859f, 6.910156f, -9.117188f, -13.140625f, 5.261719f, 15.796875f, 7.398438f, -26.125000f, 5.738281f, 13.968750f, -8.023438f, 10.445312f, -7.496094f, 16.765625f, -16.640625f, -3.904297f, 11.632812f, 7.175781f, -9.039062f, 1.875977f, 4.355469f, 3.847656f, -5.480469f, -4.613281f, 19.921875f, 4.820312f, -6.625000f, 1.696289f, 2.574219f, -4.964844f, -14.078125f, -0.264160f, -6.828125f, 5.980469f, -4.246094f, 23.562500f, 7.292969f, -3.525391f, -13.906250f, 0.611328f, 14.343750f, -8.492188f, -7.625000f, -11.703125f, -5.703125f, -9.101562f, 0.451172f, 18.937500f, 15.148438f, -1.603516f, 4.085938f, 9.539062f, -6.703125f, 6.101562f, 4.062500f, 12.171875f, -13.359375f, -1.354492f, 6.269531f, 10.882812f, -18.000000f, -4.777344f, -9.640625f, -1.679688f, 1.945312f, 6.988281f, -11.968750f, -18.640625f, 10.867188f, -2.853516f, -13.835938f, -0.342041f, 0.238525f, -4.289062f, -0.439209f, -7.820312f, -3.240234f, 11.382812f, -4.601562f, 3.472656f, -0.317627f, -1.686523f, -13.164062f, -5.074219f, 27.093750f, 9.398438f, -0.906250f, 0.516113f, 10.218750f, 21.109375f, -4.179688f, -18.640625f, 11.343750f, -23.203125f, 3.578125f, 19.609375f, 18.750000f, 1.047852f, 3.234375f, 1.600586f, 11.320312f, -1.328125f, -5.171875f, -19.375000f, 6.343750f, 2.927734f, 6.289062f, -3.433594f, 16.218750f, -11.828125f, 2.162109f, 11.664062f, 9.632812f, -15.609375f, -13.828125f, 5.453125f, -2.068359f, 0.256836f, -0.169434f, -2.240234f, 15.507812f, -0.507812f, 2.234375f, 9.500000f, 10.476562f, 2.423828f, -13.632812f, 7.257812f, -11.281250f, -4.296875f, 2.537109f, 6.304688f, 3.015625f, -4.734375f, -14.476562f, 3.882812f, -13.789062f, 8.125000f, 7.371094f, -1.534180f, -2.839844f, -11.851562f, -2.193359f, 7.109375f, 9.468750f, 4.390625f, -13.695312f, -0.116028f, -10.757812f, 5.015625f, -4.242188f, -9.890625f, 0.008736f, -4.183594f, -6.031250f, 9.101562f, -7.722656f, -4.496094f, -17.656250f, 0.920410f, 21.812500f, -12.804688f, -9.679688f, 5.949219f, 12.281250f, 2.677734f, -7.957031f, -11.820312f, -8.921875f, -6.980469f, -3.085938f, -8.570312f, 3.513672f, 3.457031f, -0.972656f, -2.287109f, 0.461914f, 6.710938f, 15.671875f, -11.554688f, 3.216797f, 3.863281f, 5.871094f, 0.506348f, -23.953125f, 5.289062f, -15.937500f, -2.382812f, -15.414062f, 27.734375f, 21.765625f, -14.335938f, -17.109375f, 6.828125f, 17.875000f, 10.703125f, -18.671875f, -13.882812f, -1.803711f, 2.324219f, -11.117188f, -3.990234f, -3.988281f, 0.961426f, 0.430176f, -17.812500f, 8.171875f, 2.185547f, 11.187500f, -6.679688f, -9.382812f, 9.429688f, 15.789062f, -7.871094f, -4.308594f, 15.601562f, -0.599121f, 11.406250f, 17.953125f, -14.023438f, 9.117188f, 12.265625f, -16.625000f, -3.835938f, 10.218750f, 21.359375f, 12.851562f, -7.019531f, -6.875000f, -10.804688f, 0.242554f, -7.238281f, -5.203125f, -8.117188f, 4.613281f, 3.339844f, -20.718750f, -12.492188f, 0.344482f, 4.941406f, 5.792969f, 18.171875f, 2.980469f, -6.324219f, 18.218750f, 1.821289f, -14.500000f, -12.656250f, 8.656250f, -6.398438f, -12.437500f, 8.742188f, -3.835938f, 10.695312f, -2.392578f, 8.632812f, -0.157593f, 1.920898f, -0.417969f, 1.019531f, -8.273438f, -16.234375f, -7.187500f, -8.984375f, -5.789062f, -4.437500f, -3.480469f, -12.070312f, -6.128906f, 6.988281f, -5.792969f, 6.515625f, 16.062500f, -4.070312f, 0.173706f, -2.515625f, -4.957031f, 9.500000f, -18.703125f, -3.029297f, -5.566406f, -5.445312f, 5.636719f, -12.718750f, 15.515625f, 4.164062f, -10.148438f, 3.880859f, 23.171875f, -10.757812f, 7.535156f, -7.574219f, -24.453125f, -7.957031f, 3.617188f, 4.671875f, -8.390625f, -4.121094f, 6.121094f, 6.777344f, -11.820312f, 2.316406f, 13.421875f, 12.976562f, 8.210938f, 1.196289f, -18.796875f, 4.539062f, -7.957031f, -4.003906f, 24.875000f, -2.990234f, -5.707031f, -0.254639f, -4.925781f, -1.029297f, -11.390625f, -13.843750f, -0.464600f, 17.015625f, -17.265625f, -15.484375f, 7.050781f, 0.687500f, -16.312500f, -23.765625f, 4.292969f, 9.343750f, 13.632812f, -9.695312f, 13.765625f, -2.156250f, -5.410156f, 2.427734f, 8.718750f, 0.444824f, 11.242188f, -3.251953f, -16.375000f, -4.093750f, 11.726562f, -5.847656f, 14.718750f, -0.486816f, 0.748535f, 0.419922f, -2.990234f, 3.726562f, -28.281250f, -16.593750f, 2.546875f, -14.304688f, 2.011719f, -7.980469f, 10.562500f, 14.726562f, 4.425781f, 1.742188f, 1.907227f, -0.798828f, -3.824219f, -10.585938f, 8.046875f, -9.390625f, -5.667969f, -10.578125f, -2.775391f, 12.921875f, -3.703125f, 5.773438f, 8.562500f, 9.562500f, 10.625000f, 10.875000f, -12.257812f, -8.382812f, 8.585938f, -9.437500f, -6.285156f, -10.984375f, -3.937500f, 7.578125f, 6.808594f, 1.359375f, -7.804688f, -19.921875f, -9.835938f, -2.611328f, 7.339844f, -15.015625f, -10.734375f, -1.287109f, 3.410156f, 9.179688f, 0.935547f, 2.041016f, -15.742188f, -12.429688f, 11.546875f, -0.912598f, -7.054688f, 6.894531f, 12.648438f, 1.964844f, -1.995117f, 4.847656f, 12.921875f, -0.662598f, -4.308594f, -5.222656f, 13.281250f, 5.214844f, 6.847656f, -7.250000f, -0.868652f, -4.507812f, -1.020508f, -3.806641f, -1.188477f, -4.921875f, -13.796875f, 22.187500f, -11.226562f, 5.621094f, -11.101562f, 6.593750f, 5.039062f, 5.480469f, -9.640625f, 10.109375f, -7.226562f, 2.310547f, -7.761719f, 0.339844f, -6.902344f, 5.058594f, 9.984375f, 12.750000f, -9.929688f, -15.601562f, -16.687500f, -1.421875f, 12.460938f, -16.750000f, 0.671387f, -2.427734f, 14.375000f, 10.492188f, 8.570312f, 9.507812f, 10.617188f, -16.593750f, -9.921875f, 2.035156f, -1.250000f, 3.886719f, 4.796875f, -7.703125f, -5.796875f, -17.203125f, -10.750000f, -2.220703f, 2.546875f, 9.554688f, -5.898438f, 20.843750f, -7.332031f, -7.800781f, 8.070312f, -16.500000f, -21.984375f, 9.375000f, 0.200562f, 0.799805f, 0.412842f, 1.871094f, -9.625000f, 0.148193f, 10.429688f, 5.468750f, 1.358398f, -0.734863f, 9.437500f, 1.203125f, 4.757812f, 14.234375f, 12.851562f, 3.386719f, -0.622070f, -11.984375f, 5.945312f, -1.348633f, -0.412842f, -7.042969f, 9.820312f, 3.898438f, 6.507812f, 7.226562f, 0.948730f, 5.332031f, -22.968750f, 6.523438f, 9.406250f, -4.054688f, -2.640625f, -2.486328f, -5.027344f, 3.255859f, -15.250000f, 0.107971f, -11.015625f, 8.546875f, -5.757812f, 7.460938f, 10.257812f, -11.304688f, -1.981445f, -14.687500f, 12.242188f, 13.875000f, -22.656250f, -5.691406f, -8.804688f, 3.875000f, 0.033417f, 8.984375f, -27.578125f, -9.414062f, 23.406250f, -4.156250f, 3.833984f, 2.539062f, 8.554688f, -16.250000f, -9.992188f, 1.302734f, 22.296875f, -16.890625f, -25.562500f, -3.544922f, -5.843750f, 2.531250f, -6.570312f, 6.082031f, -15.093750f, -0.511230f, 0.744629f, 1.049805f, -3.882812f, -1.634766f, -0.179688f, -9.000000f, 8.351562f, 3.416016f, 4.406250f, -0.814941f, -5.421875f, 6.187500f, 9.484375f, 3.482422f, -13.210938f, 1.721680f, -8.460938f, -7.882812f, 7.738281f, -5.230469f, -11.382812f, 4.863281f, -1.270508f, 10.945312f, 1.562500f, 1.564453f, -2.871094f, -18.046875f, 2.263672f, 4.019531f, 4.644531f, 7.523438f, 1.979492f, -12.195312f, 6.074219f, -8.523438f, -2.125000f, 8.296875f, 3.402344f, 2.136719f, 18.812500f, 1.597656f, 1.828125f, 0.350098f, -9.046875f, -6.859375f, 20.671875f, 0.978516f, 4.730469f, 13.476562f, -9.085938f, -1.445312f, 6.484375f, 8.750000f, 12.601562f, 3.068359f, -8.890625f, -16.656250f, 14.203125f, -12.859375f, -0.910156f, -12.656250f, 0.489502f, 11.804688f, 16.015625f, -6.699219f, 6.957031f, -8.453125f, 4.363281f, -13.500000f, -9.820312f, -5.917969f, 11.867188f, 10.242188f, 10.703125f, 10.070312f, -4.125000f, 8.140625f, -6.019531f, 20.421875f, 11.867188f, 1.169922f, -9.078125f, -4.757812f, -14.992188f, -4.363281f, 10.750000f, -6.882812f, -0.408203f, -14.765625f, -15.781250f, -0.123962f, -13.914062f, -7.320312f, 4.078125f, 2.666016f, 4.972656f, 1.576172f, -9.375000f, 9.859375f, 0.345215f, 6.152344f, 7.367188f, -2.214844f, -13.609375f, 1.009766f, -13.507812f, 12.093750f, 1.190430f, -5.660156f, 5.593750f, -19.437500f, 17.437500f, -8.062500f, -6.953125f, -10.484375f, 8.953125f, -2.351562f, -6.652344f, -9.179688f, -2.757812f, 2.843750f, 6.871094f, -10.203125f, 16.781250f, -1.027344f, -12.234375f, 2.509766f, -1.168945f, 4.101562f, 2.039062f, 5.148438f, 14.109375f, 1.338867f, 12.453125f, 26.843750f, 11.640625f, 2.500000f, 0.619629f, -7.320312f, 9.984375f, -7.972656f, 10.757812f, -22.093750f, -10.851562f, -7.382812f, 6.433594f, -1.346680f, 14.296875f, -11.992188f, 10.625000f, -3.558594f, 3.994141f, -12.101562f, -9.335938f, 1.636719f, -3.916016f, 14.843750f, 9.859375f, -17.609375f, -5.503906f, 21.484375f, 10.750000f, 2.564453f, -26.937500f, 1.275391f, 3.861328f, 0.266602f, 12.937500f, -8.617188f, 12.140625f, -11.812500f, 0.253174f, -10.453125f, -1.754883f, -6.707031f, 11.648438f, 4.445312f, 3.365234f, 0.368164f, -4.734375f, 3.937500f, 16.015625f, -10.796875f, -12.710938f, -1.673828f, 17.593750f, 8.953125f, -17.156250f, 4.593750f, -6.535156f, 0.596680f, -11.062500f, -0.856934f, 8.078125f, -4.117188f, 10.257812f, -12.835938f, -13.585938f, -0.140381f, 5.453125f, 16.078125f, 18.296875f, -5.191406f, 2.140625f, -6.781250f, 8.328125f, 12.328125f, 2.320312f, -7.468750f, -15.695312f, -9.242188f, 1.868164f, -17.640625f, 3.056641f, -22.562500f, 15.523438f, 9.750000f, -19.343750f, 3.707031f, -4.222656f, 7.171875f, -2.128906f, -0.553223f, 6.046875f, 10.742188f, 0.485840f, -6.957031f, 3.574219f, 20.625000f, 10.281250f, 9.617188f, 3.509766f, -3.230469f, -2.326172f, -18.093750f, -4.417969f, 2.556641f, -3.207031f, -5.902344f, 4.292969f, -15.921875f, -0.257812f, -17.609375f, 0.293457f, -13.296875f, -11.585938f, 4.804688f, 1.904297f, -0.340332f, -0.272461f, 1.341797f, 2.753906f, 4.148438f, -11.726562f, -17.437500f, -1.759766f, 1.939453f, -6.191406f, 3.421875f, 1.262695f, 20.828125f, -1.323242f, -2.132812f, -14.289062f, 11.695312f, -15.093750f, -6.453125f, -9.445312f, 7.492188f, -13.234375f, -3.087891f, -8.945312f, 27.265625f, 17.421875f, 3.707031f, -4.175781f, 6.738281f, 14.875000f, -9.468750f, -4.621094f, 19.109375f, 0.158081f, 0.026978f, -1.777344f, -0.719238f, 0.955078f, -5.417969f, -7.828125f, 9.039062f, -9.609375f, 6.437500f, 4.605469f, -6.871094f, 16.078125f, 3.708984f, 0.302002f, -0.696289f, -0.704590f, -7.136719f, -13.429688f, -2.378906f, 4.257812f, -17.046875f, -9.695312f, -3.316406f, -9.343750f, -2.025391f, -5.472656f, -0.655273f, -7.953125f, -0.625488f, 4.652344f, 16.953125f, 5.167969f, -13.382812f, 15.890625f, -3.218750f, 1.004883f, 12.062500f, 4.742188f, 1.678711f, -12.320312f, -6.027344f, 11.250000f, 10.046875f, 0.279541f, -22.718750f, -12.960938f, 2.302734f, -13.140625f, -7.121094f, -21.250000f, 7.410156f, 2.552734f, -12.218750f, 12.546875f, 21.375000f, 1.121094f, -17.000000f, -8.593750f, -5.476562f, -7.894531f, 6.535156f, 10.679688f, -10.187500f, 13.875000f, -14.789062f, -3.363281f, 7.648438f, 7.781250f, 4.257812f, -22.484375f, 6.300781f, 11.289062f, 5.734375f, -11.695312f, -21.421875f, -13.109375f, 6.792969f, 2.193359f, -8.210938f, -12.031250f, 13.218750f, -9.632812f, -14.171875f, 0.402344f, -0.494141f, 0.029724f, -3.052734f, 11.539062f, 17.140625f, 6.617188f, 28.640625f, 8.929688f, 7.546875f, 13.859375f, -9.734375f, -8.757812f, 11.781250f, -14.617188f, -3.720703f, -7.789062f, 9.054688f, 1.609375f, -1.468750f, 4.437500f, -7.171875f, -1.668945f, -3.048828f, 2.847656f, 5.792969f, -17.500000f, 5.664062f, 1.816406f, -12.195312f, -1.610352f, 10.195312f, 1.409180f, 0.506836f, 4.398438f, -7.847656f, 5.476562f, -24.140625f, -4.222656f, 8.921875f, -3.316406f, 16.343750f, -2.732422f, -1.881836f, -2.787109f, 18.609375f, 2.337891f, 5.730469f, -10.765625f, 2.697266f, 1.504883f, -14.945312f, -6.054688f, -5.335938f, -2.859375f, -2.980469f, -1.719727f, 10.453125f, -1.175781f, 0.001366f, 1.819336f, -8.453125f, -8.054688f, 12.265625f, -5.773438f, 14.031250f, -3.617188f, 10.070312f, 11.304688f, -1.307617f, -9.320312f, 4.957031f, -12.609375f, 2.134766f, -9.851562f, -0.063843f, 10.257812f, -3.332031f, -7.410156f, 11.468750f, 0.487305f, 15.421875f, 1.496094f, 0.225952f, -2.550781f, 7.558594f, 8.062500f, 10.929688f, 13.257812f, 6.386719f, 7.949219f, -6.484375f, 16.609375f, 6.132812f, -2.900391f, -6.894531f, 4.386719f, 13.101562f, 2.472656f, 0.867188f, 11.867188f, -11.039062f, 8.187500f, -1.906250f, -19.937500f, 2.976562f, 3.978516f, 4.402344f, 2.332031f, -2.060547f, 1.347656f, 16.312500f, -5.812500f, -6.292969f, -3.603516f, -8.492188f, -11.140625f, -5.574219f, -11.601562f, -1.159180f, -9.007812f, -16.546875f, -7.910156f, -3.488281f, -4.917969f, -7.730469f, -6.343750f, 7.046875f, 6.070312f, -2.845703f, -3.554688f, -4.824219f, -1.256836f, 5.343750f, 10.015625f, -11.617188f, -14.523438f, 11.062500f, -15.914062f, 9.656250f, 3.072266f, -3.945312f, -28.671875f, 3.734375f, -11.898438f, -10.140625f, 24.484375f, -5.285156f, 5.460938f, 7.789062f, 8.835938f, -5.183594f, -0.898438f, -12.828125f, -2.923828f, 2.140625f, 13.148438f, 22.171875f, -10.531250f, 5.781250f, -2.214844f, 11.968750f, 3.126953f, 22.953125f, -19.218750f, 14.757812f, 10.953125f, -8.632812f, -18.937500f, -5.429688f, -4.039062f, -2.478516f, -6.500000f, 2.296875f, -12.187500f, -5.777344f, -6.683594f, -3.906250f, 17.531250f, 0.767090f, -5.828125f, 0.546875f, -12.156250f, 7.921875f, -7.492188f, -6.089844f, -21.046875f, 13.250000f, 19.796875f, 9.906250f, -4.718750f }; +static const float16 vec_b[] = { -7.289062f, 8.796875f, -20.312500f, -13.632812f, -9.484375f, -27.484375f, -0.328369f, 8.812500f, -1.603516f, -5.343750f, 1.144531f, -6.339844f, 13.671875f, -14.570312f, 11.148438f, 9.164062f, 1.923828f, -6.109375f, -6.386719f, 16.031250f, -19.437500f, 13.835938f, 18.296875f, -0.481689f, -13.054688f, -0.025726f, -7.128906f, -3.638672f, 4.546875f, 5.671875f, -17.046875f, -3.566406f, 9.906250f, 6.660156f, 3.759766f, -0.114746f, -21.140625f, 8.007812f, -10.718750f, 18.375000f, 3.000000f, 5.019531f, 4.207031f, -14.359375f, 12.695312f, 6.394531f, 11.507812f, 11.992188f, 13.312500f, 7.750000f, -1.370117f, 3.771484f, -12.351562f, -2.716797f, 14.656250f, 15.726562f, 1.442383f, 5.433594f, 17.015625f, 2.673828f, 21.296875f, -0.902344f, -10.515625f, 7.937500f, -7.472656f, 0.192627f, 1.977539f, -24.015625f, -10.718750f, -18.000000f, 7.429688f, -0.196045f, 6.140625f, 3.429688f, -12.101562f, 2.228516f, -3.998047f, 8.968750f, -7.925781f, -3.369141f, 7.914062f, 11.000000f, -3.220703f, 0.470947f, -5.078125f, 1.471680f, -2.042969f, 20.875000f, -13.968750f, 2.234375f, -14.085938f, -0.246582f, -3.470703f, -6.519531f, 3.000000f, 7.300781f, 10.132812f, 9.132812f, -6.781250f, 10.976562f, -3.560547f, 0.851074f, -3.759766f, -11.234375f, 0.826660f, -3.587891f, -0.254150f, -5.867188f, 12.312500f, -9.351562f, -4.542969f, 11.320312f, 15.828125f, -15.890625f, -5.726562f, -1.074219f, -13.992188f, 8.242188f, -12.273438f, 5.796875f, -8.750000f, -2.384766f, -6.789062f, -5.082031f, 9.007812f, 5.605469f, 9.304688f, 31.765625f, -16.406250f, 8.617188f, 4.519531f, 12.648438f, 4.015625f, 1.390625f, -9.867188f, -11.101562f, 16.406250f, 10.117188f, 18.109375f, 4.445312f, 7.191406f, 0.185547f, 4.804688f, 2.648438f, -9.687500f, 2.009766f, 14.343750f, -3.636719f, 2.361328f, -2.880859f, 6.757812f, -6.175781f, -13.789062f, -19.328125f, 19.093750f, -4.359375f, -7.378906f, 10.445312f, -14.023438f, -2.324219f, -4.855469f, 12.890625f, -10.164062f, -2.953125f, 12.593750f, 25.484375f, 10.359375f, 22.968750f, -0.619629f, 5.476562f, -2.052734f, -5.906250f, -16.812500f, 10.039062f, 5.644531f, 2.107422f, -13.960938f, 6.250000f, 0.185181f, 10.789062f, -10.656250f, 11.429688f, 5.179688f, -7.000000f, -5.261719f, -7.125000f, -13.328125f, -17.109375f, -0.913086f, -2.615234f, 0.759277f, -14.078125f, -14.195312f, -0.323975f, 19.031250f, -16.312500f, -4.539062f, -0.218262f, -5.917969f, -21.015625f, 17.203125f, -2.839844f, 4.195312f, -6.074219f, 5.472656f, -18.203125f, -7.902344f, -2.810547f, -11.273438f, -5.300781f, 4.179688f, -9.554688f, 17.328125f, -1.090820f, 6.234375f, -0.465088f, -0.708984f, 4.152344f, -17.171875f, 1.466797f, 1.021484f, -6.863281f, 0.671387f, -0.196411f, 7.843750f, -13.218750f, -1.906250f, -6.941406f, -3.023438f, -15.273438f, 4.718750f, -8.484375f, -1.927734f, 1.020508f, -18.187500f, -0.481445f, -15.351562f, 8.226562f, 2.289062f, -3.595703f, 7.972656f, 1.419922f, -13.906250f, -0.272705f, -3.113281f, -4.199219f, -2.734375f, -1.293945f, 6.031250f, -9.273438f, 12.609375f, -6.535156f, -12.789062f, 13.281250f, 11.414062f, 12.054688f, 12.484375f, -0.201416f, -1.745117f, -12.804688f, 7.171875f, -11.093750f, 16.796875f, -14.570312f, -7.093750f, 2.935547f, 4.875000f, 3.130859f, 7.953125f, -0.176880f, 10.257812f, 16.609375f, -4.652344f, -7.582031f, 3.417969f, 9.226562f, 12.984375f, -4.566406f, 1.060547f, 5.644531f, -21.468750f, 2.558594f, -11.054688f, -6.410156f, -7.109375f, 6.945312f, -12.562500f, -2.867188f, 19.500000f, -6.386719f, 4.312500f, 6.878906f, 12.226562f, 0.510254f, -12.367188f, -24.218750f, 17.546875f, -3.755859f, -12.390625f, -0.673828f, 2.841797f, -7.664062f, 8.671875f, -5.921875f, 12.710938f, -4.687500f, -9.531250f, -3.845703f, 1.411133f, -4.144531f, 6.191406f, 16.359375f, -6.703125f, -8.414062f, -12.679688f, 7.578125f, -17.968750f, 1.682617f, 17.015625f, 3.494141f, -1.513672f, 9.578125f, 4.460938f, 7.757812f, 2.525391f, 5.304688f, -5.921875f, -6.554688f, -13.437500f, -4.445312f, 15.648438f, 6.066406f, -8.914062f, 7.882812f, 6.156250f, -7.031250f, 6.105469f, 14.750000f, -1.643555f, 13.171875f, -15.945312f, 5.453125f, 0.328369f, -18.828125f, -11.281250f, -7.632812f, 19.406250f, -6.207031f, -21.656250f, -0.635254f, -2.568359f, 17.437500f, 2.183594f, 2.150391f, 7.406250f, -13.507812f, 0.998535f, -20.734375f, 19.656250f, -6.746094f, -23.296875f, -16.796875f, -12.109375f, -13.007812f, -9.484375f, -5.128906f, -1.745117f, 9.921875f, 0.523438f, 8.546875f, -10.000000f, -2.900391f, -20.062500f, 11.382812f, 2.199219f, -10.242188f, -3.412109f, 8.015625f, 16.765625f, -17.687500f, -1.549805f, 20.140625f, -12.289062f, 4.398438f, 1.385742f, -0.269287f, 2.931641f, -2.011719f, -2.683594f, -9.953125f, -3.087891f, -23.328125f, 5.300781f, 5.878906f, 10.148438f, -12.546875f, 1.537109f, -17.531250f, 14.328125f, 6.207031f, -4.582031f, 23.625000f, 7.343750f, -7.390625f, -5.726562f, -3.988281f, 1.729492f, 17.859375f, -5.300781f, 12.000000f, 2.017578f, 11.351562f, 8.875000f, 3.310547f, 3.001953f, 1.922852f, -8.929688f, -9.492188f, 12.484375f, 10.234375f, -33.781250f, 2.189453f, 5.390625f, 14.671875f, -0.053406f, -5.273438f, -10.796875f, -0.408447f, -8.851562f, 15.109375f, 19.187500f, 9.375000f, -8.406250f, 12.429688f, 19.031250f, -5.996094f, -7.781250f, 0.795898f, 2.828125f, 1.451172f, 22.656250f, -4.621094f, -11.687500f, 12.312500f, -4.929688f, 7.238281f, 4.019531f, -8.351562f, -3.076172f, 10.109375f, 7.187500f, -0.645508f, -13.046875f, -1.791992f, 1.444336f, 3.476562f, -1.087891f, -1.376953f, -2.306641f, 5.894531f, 4.847656f, 2.767578f, -3.326172f, 14.500000f, -14.148438f, -12.695312f, 12.796875f, 20.671875f, -0.251709f, -6.703125f, -3.931641f, 15.359375f, 0.631348f, 5.792969f, -9.765625f, -9.085938f, -9.578125f, 10.960938f, 14.984375f, -19.203125f, 6.878906f, 4.472656f, -8.734375f, -4.015625f, -1.121094f, 10.820312f, -0.045258f, -10.351562f, -7.921875f, -6.500000f, 18.406250f, -0.063293f, -3.728516f, 5.175781f, 2.009766f, 10.789062f, -4.660156f, 1.763672f, -7.347656f, -2.648438f, -12.960938f, -9.789062f, 1.315430f, -11.257812f, 9.898438f, -10.625000f, -0.835449f, 8.445312f, -15.859375f, 0.901855f, -12.203125f, -3.431641f, 13.101562f, -4.734375f, -0.999023f, -9.523438f, 10.195312f, -19.656250f, -12.890625f, -14.148438f, -12.750000f, 19.671875f, -2.365234f, -1.854492f, 2.478516f, 4.398438f, -13.203125f, -11.554688f, -3.996094f, 10.984375f, -14.468750f, 7.820312f, -4.562500f, -3.589844f, 1.588867f, -2.818359f, 1.605469f, 10.851562f, -12.093750f, 10.656250f, -2.386719f, 3.611328f, 0.742188f, -8.257812f, -3.566406f, -5.964844f, 2.375000f, -5.648438f, 6.925781f, 6.988281f, 5.820312f, 1.923828f, 5.281250f, 14.539062f, -2.054688f, 0.102661f, -3.277344f, -13.156250f, -2.644531f, -5.757812f, -5.718750f, 6.722656f, -4.941406f, 1.197266f, -10.054688f, -13.953125f, -1.300781f, -15.515625f, 14.187500f, 11.796875f, -7.792969f, -3.691406f, 5.265625f, -16.843750f, 18.906250f, -0.421387f, -15.617188f, 4.167969f, 3.316406f, -1.110352f, -16.265625f, -0.065674f, -10.320312f, -18.046875f, 3.267578f, -0.447266f, 1.203125f, 0.407959f, -9.937500f, 1.914062f, -5.796875f, 7.156250f, -0.688477f, -8.234375f, -4.562500f, -15.359375f, -19.531250f, 1.115234f, 9.210938f, -16.953125f, -11.593750f, -13.570312f, 10.718750f, -14.289062f, -2.226562f, -11.859375f, -19.515625f, 1.763672f, 0.632324f, -7.816406f, 7.597656f, -16.281250f, 25.609375f, -4.277344f, -9.187500f, -4.562500f, 1.794922f, -7.648438f, -0.874512f, -18.375000f, 9.828125f, 13.125000f, 6.828125f, -12.890625f, -4.203125f, -8.343750f, 2.849609f, -0.891602f, -5.269531f, 8.265625f, 8.820312f, -0.656738f, 2.701172f, -5.035156f, 2.388672f, 5.687500f, -2.503906f, -11.312500f, -3.742188f, -10.507812f, 14.726562f, 3.929688f, 18.046875f, -1.987305f, -7.406250f, -0.720215f, -3.986328f, 3.617188f, 0.841309f, 6.613281f, 8.984375f, -12.101562f, -1.857422f, -18.250000f, 8.859375f, -13.109375f, -6.328125f, -14.062500f, 16.109375f, 8.375000f, 11.953125f, 1.534180f, -4.312500f, -9.382812f, -0.202637f, -19.046875f, -20.671875f, 2.044922f, 1.091797f, 7.800781f, 3.558594f, 5.035156f, 1.966797f, 3.220703f, 12.328125f, -5.675781f, -1.219727f, -8.289062f, -4.343750f, 8.109375f, 10.156250f, -22.156250f, 2.537109f, -0.525391f, -0.927246f, -7.816406f, 7.878906f, 3.035156f, 1.968750f, 6.906250f, -6.929688f, -9.960938f, 11.515625f, 1.176758f, 3.130859f, 0.533691f, -14.140625f, 18.750000f, 1.634766f, 2.261719f, -5.062500f, 9.367188f, 0.865723f, 3.826172f, 3.052734f, 27.000000f, 8.640625f, -5.437500f, 19.218750f, 1.699219f, -0.889648f, -6.214844f, -12.828125f, 11.578125f, 4.992188f, 1.073242f, 0.474854f, -2.634766f, 0.171021f, 6.433594f, 9.453125f, 2.746094f, 8.578125f, -5.683594f, -0.344482f, -6.687500f, -12.187500f, 6.234375f, 3.242188f, 4.449219f, 0.754883f, -4.906250f, -5.804688f, 6.003906f, -1.361328f, -1.363281f, -15.960938f, 20.359375f, 2.998047f, -19.062500f, -16.171875f, 0.464111f, 2.054688f, -18.453125f, 6.492188f, 10.851562f, -6.750000f, 6.609375f, -5.019531f, -13.367188f, 3.599609f, 0.235229f, 11.187500f, -7.664062f, 19.781250f, 3.933594f, 10.171875f, -7.582031f, 3.337891f, -4.988281f, 14.585938f, -15.101562f, -11.437500f, -5.308594f, 10.171875f, -5.003906f, 6.347656f, -3.607422f, 8.929688f, -5.996094f, -10.734375f, -2.205078f, -7.554688f, -6.507812f, 6.851562f, 7.812500f, 4.851562f, 19.140625f, 2.685547f, 10.117188f, 6.812500f, 1.380859f, -5.832031f, -2.265625f, 24.156250f, 9.289062f, 8.335938f, -1.715820f, 17.875000f, 5.964844f, -0.133789f, -1.529297f, 21.750000f, -6.800781f, 19.531250f, -6.312500f, 10.218750f, -8.281250f, -10.085938f, 12.515625f, -19.468750f, -0.210815f, -1.290039f, -11.328125f, 11.375000f, -6.753906f, 0.887695f, 13.648438f, -4.265625f, -2.414062f, 5.757812f, -17.484375f, 6.777344f, -16.156250f, 6.011719f, 5.035156f, -3.853516f, 7.335938f, -0.071045f, 8.984375f, -1.783203f, -1.447266f, -19.765625f, 17.859375f, 11.289062f, -6.191406f, -16.656250f, -8.351562f, 15.742188f, 18.156250f, 9.578125f, 4.851562f, -5.886719f, -11.101562f, -12.289062f, 8.507812f, 5.843750f, -6.449219f, -10.710938f, -4.890625f, 14.742188f, 4.960938f, -4.644531f, -1.206055f, -3.578125f, 17.453125f, -3.138672f, -7.675781f, -13.617188f, 11.203125f, -4.832031f, 10.218750f, 9.640625f, 1.342773f, -4.917969f, 10.757812f, -3.103516f, -18.406250f, 0.186890f, -8.656250f, -9.906250f, 4.421875f, 16.500000f, -8.125000f, 1.752930f, 1.453125f, 0.287598f, -1.258789f, -8.117188f, -23.468750f, 12.656250f, -5.800781f, 11.945312f, 4.742188f, 16.203125f, 1.796875f, 4.804688f, -7.003906f, 0.362793f, 8.468750f, 19.531250f, -23.515625f, -2.373047f, 1.969727f, -6.570312f, -11.187500f, -1.838867f, -8.726562f, 9.828125f, -0.407959f, 1.312500f, 12.632812f, -5.394531f, 7.031250f, 2.076172f, -7.609375f, -1.354492f, -10.554688f, 3.599609f, -5.949219f, 15.414062f, -0.606445f, 10.617188f, 6.609375f, 22.843750f, 1.425781f, -6.441406f, -3.761719f, -4.570312f, -0.982910f, -6.628906f, 7.742188f, -5.019531f, -1.332031f, 10.085938f, -5.125000f, 14.289062f, 0.077881f, 0.052094f, 19.046875f, -7.347656f, -21.078125f, 4.949219f, 1.802734f, -12.250000f, 0.814941f, -0.700684f, 1.202148f, 0.540527f, -3.125000f, 9.812500f, 9.390625f, 25.921875f, 0.729004f, 1.905273f, -4.996094f, -18.625000f, 3.187500f, -0.410400f, 1.663086f, 10.046875f, 10.250000f, -4.964844f, 5.582031f, 1.952148f, -3.564453f, -14.109375f, -2.945312f, 0.707031f, 13.054688f, -8.609375f, 2.919922f, -8.859375f, 1.507812f, -5.402344f, -10.953125f, 15.507812f, 15.617188f, -5.687500f, -0.325195f, 9.757812f, -26.140625f, -6.695312f, 13.148438f, -4.277344f, 5.984375f, 6.886719f, -11.937500f, -3.533203f, -17.265625f, 6.246094f, 5.578125f, -5.734375f, -3.195312f, 4.730469f, -17.671875f, -26.625000f, -8.773438f, 8.773438f, -1.392578f, -7.046875f, 15.914062f, 11.312500f, 6.890625f, 1.508789f, -2.662109f, 3.880859f, 12.773438f, 7.007812f, 15.429688f, -10.578125f, 5.558594f, -4.515625f, 17.296875f, -12.437500f, 13.500000f, 13.242188f, -0.543457f, 14.429688f, 6.578125f, -8.679688f, -4.785156f, -1.598633f, 3.988281f, 3.707031f, 1.142578f, -3.556641f, 15.546875f, 14.796875f, 10.609375f, -12.164062f, 6.042969f, 19.234375f, 7.398438f, -8.937500f, 21.687500f, 1.115234f, -17.859375f, 9.945312f, -13.117188f, 16.640625f, 3.136719f, -0.645508f, 17.953125f, 5.074219f, 11.539062f, -16.000000f, 7.593750f, -6.203125f, -12.429688f, 13.656250f, 6.046875f, -18.859375f, 2.835938f, -2.056641f, -1.421875f, -0.637207f, -10.835938f, -18.531250f, 16.812500f, -2.669922f, 12.750000f, 19.515625f, -20.000000f, 1.944336f, -5.804688f, 12.351562f, -1.315430f, 8.882812f, 11.546875f, -6.761719f, 10.398438f, 1.570312f, -10.640625f, -5.414062f, -3.908203f, -8.437500f, 8.367188f, 1.294922f, -3.546875f, -14.843750f, 1.791992f, -5.367188f, 0.998047f, 0.971191f, 4.843750f, -17.484375f, -6.832031f, -5.648438f, -4.093750f, -7.812500f, -0.122742f, -12.156250f, 5.726562f, 1.945312f, 16.937500f, -11.789062f, 7.550781f, 13.382812f, 1.334961f, 0.113220f, -2.171875f, 2.224609f, -14.429688f, -2.837891f, 1.783203f, -6.140625f, 6.910156f, -20.109375f, 9.257812f, -1.501953f, 10.414062f, -6.062500f, 1.785156f, 10.523438f, 10.187500f, 0.302490f, 0.087158f, 8.359375f, 5.750000f, 0.728516f, 0.358398f, -0.778809f, -10.523438f, -0.525879f, -10.554688f, 6.078125f, 5.746094f, -19.828125f, -9.578125f, 5.066406f, -2.507812f, -7.765625f, -8.835938f, -9.851562f, 3.480469f, -3.296875f, 12.187500f, 10.664062f, 3.218750f, -11.234375f, 15.695312f, -7.332031f, -3.750000f, 11.757812f, 15.945312f, 9.953125f, 13.867188f, 9.726562f, 8.617188f, 1.443359f, 7.683594f, -4.894531f, 24.953125f, -10.820312f, 6.160156f, -15.523438f, -2.269531f, -8.726562f, -4.304688f, 1.289062f, 2.744141f, 0.945801f, 12.625000f, 4.210938f, 2.316406f, 11.039062f, -13.023438f, -0.658691f, 16.390625f, 1.954102f, 3.794922f, -8.132812f, 11.187500f, -9.539062f, 0.171143f, -12.984375f, -7.734375f, -0.893555f, 4.953125f, 21.656250f, -3.673828f, -2.845703f, -0.958984f, 1.078125f, 0.605957f, 8.796875f, -6.875000f, -5.792969f, 11.500000f, 7.671875f, 4.296875f, -4.316406f, 6.410156f, -18.468750f, -14.539062f, -11.367188f, 17.671875f, -4.230469f, -2.142578f, 22.234375f, 4.250000f, 0.253174f, 5.218750f, 2.357422f, 3.351562f, 4.269531f, -5.871094f, 14.226562f, -9.062500f, 14.960938f, 0.581543f, 7.835938f, 9.257812f, 2.255859f, 8.546875f, -2.521484f, 2.742188f, -2.845703f, 10.937500f, -16.109375f, -2.837891f, 7.082031f, -20.546875f, -12.109375f, 3.056641f, -9.750000f, 12.414062f, -14.406250f, 3.732422f, -3.853516f, 1.366211f, 4.453125f, 9.937500f, -9.382812f, 9.664062f, -21.046875f, 17.593750f, -5.710938f, -8.304688f, 8.070312f, 10.242188f, -8.523438f, -6.941406f, -15.195312f, 7.824219f, 4.804688f, 1.754883f, 0.813965f, 15.890625f, -5.792969f, 10.718750f, 1.877930f, 2.425781f, 12.117188f, 0.195435f, -9.054688f, 2.171875f, 9.734375f, 2.230469f, 1.303711f, 0.926270f, -13.703125f, -8.226562f, 0.126831f, 14.484375f, -13.843750f, -8.164062f, 3.638672f, -10.132812f, -6.027344f, 6.937500f, -14.992188f, -18.015625f, 1.342773f, 10.687500f, -10.351562f, 7.433594f, -17.250000f, 9.585938f, 15.554688f, -7.195312f, -5.093750f, 13.656250f, -3.611328f, 0.518066f, 28.578125f, 14.257812f, -15.273438f, 0.081848f, 15.359375f, -9.335938f, -2.769531f, -8.156250f, 7.542969f, 6.441406f, -3.462891f, -11.593750f, -11.695312f, -9.023438f, -2.441406f, -5.902344f, 5.917969f, 7.261719f, 4.960938f, -11.742188f, -2.333984f, -6.929688f, 3.769531f, -11.851562f, 10.273438f, -6.792969f, 4.972656f, -4.320312f, 14.835938f, -1.179688f, 2.921875f, 7.511719f, -21.484375f, 0.861816f, -8.734375f, -5.449219f, 16.609375f, -5.253906f, 12.078125f, 2.794922f, 5.765625f, 13.609375f, 3.318359f, 6.074219f, 5.097656f, -5.949219f, -5.449219f, -4.500000f, 3.109375f, -7.378906f, 8.234375f, 8.898438f, 15.171875f, 4.101562f, 7.269531f, -5.980469f, 12.968750f, -4.281250f, 6.058594f, -11.242188f, -9.140625f, -9.367188f, 10.679688f, 4.632812f, -1.673828f, 8.734375f, 1.173828f, 3.722656f, 7.238281f, -2.636719f, -1.119141f, 13.984375f, -1.569336f, 2.748047f, -1.900391f, 13.210938f, -1.144531f, 7.402344f, -3.345703f, -14.960938f, 14.000000f, -4.703125f, -11.710938f, -11.039062f, 0.052399f, 4.832031f, -5.292969f, 9.539062f, -0.956543f, -4.859375f, -1.677734f, 2.347656f, 7.800781f, 14.179688f, -10.156250f, -10.093750f, -0.407471f, 1.005859f, 8.062500f, 4.230469f, -5.914062f, 8.851562f, 7.636719f, -4.417969f, 3.466797f, -1.559570f, 4.542969f, 1.521484f, -11.171875f, -11.203125f, -21.671875f, 9.890625f, 1.971680f, 13.898438f, 9.906250f, -4.945312f, 4.515625f, 0.285156f, -13.382812f, 4.964844f, -3.244141f, 3.437500f, 2.769531f, 4.207031f, -1.695312f, 3.437500f, 5.828125f, 18.734375f, -3.128906f, 3.302734f, -21.812500f, -5.859375f, 11.226562f, 3.359375f, 14.187500f, 1.665039f, -5.632812f, 3.949219f, -6.460938f, -12.421875f, 0.561035f, -18.515625f, 5.800781f, -8.765625f, 9.898438f, -20.031250f, 2.136719f, 21.375000f, -11.414062f, 0.364258f, -21.765625f, -5.742188f, 2.257812f, 8.750000f, -13.312500f, 3.037109f, 1.750977f, -12.179688f, -11.312500f, 19.828125f, -1.222656f, 0.885254f, 2.619141f, -5.246094f, 0.171997f, -10.632812f, -3.353516f, 6.386719f, -10.351562f, -1.735352f, -3.509766f, 7.812500f, 3.017578f, 12.125000f, -3.468750f, -20.109375f, -20.890625f, 10.429688f, -5.292969f, 7.437500f, -6.539062f, -7.695312f, 2.796875f, -32.687500f, 17.812500f, 12.289062f, -3.386719f, -13.218750f, 9.031250f, -7.582031f, -16.500000f, -0.046814f, -2.601562f, 2.933594f, -3.023438f, -9.187500f, -8.968750f, -3.416016f, -4.425781f, -0.450928f, -2.355469f, -0.220337f, 9.726562f, 8.109375f, 0.607910f, 17.203125f, 18.265625f, 3.699219f, 0.201782f, 3.693359f, -14.093750f, -3.542969f, 7.433594f, -2.509766f, 9.554688f, -22.921875f, -6.953125f, -10.164062f, -1.545898f, 1.541992f, 2.751953f, 4.230469f, -4.582031f, 3.050781f, 6.484375f, 12.773438f, -7.261719f, 2.160156f, 20.718750f, 17.968750f, -3.064453f, 4.199219f, -6.250000f, 24.500000f, -5.523438f, 6.421875f, 6.031250f, -15.742188f, -11.046875f, -5.312500f, -10.335938f, 0.411133f, 12.679688f, -7.308594f, 9.632812f, 9.867188f, 10.867188f, 0.572754f, -4.847656f, -2.625000f, 1.919922f, 14.531250f, 7.808594f, -11.945312f, 4.230469f, 6.609375f, 1.684570f, 1.472656f, -19.015625f, -5.953125f, 0.569336f, 4.585938f, 25.468750f, 5.566406f, 11.257812f, -2.111328f, -13.929688f, 11.937500f, 1.245117f, 10.015625f, -13.359375f, 2.111328f, -3.414062f, -4.406250f, 6.589844f, 11.507812f, -7.476562f, 13.125000f, 0.273193f, -8.007812f, 2.140625f, 6.113281f, 9.820312f, 2.851562f, -2.615234f, 1.146484f, 5.144531f, -6.238281f, 18.078125f, -0.826172f, 8.851562f, 23.171875f, 5.765625f, -5.031250f, -1.306641f, -12.773438f, 10.679688f, -3.117188f, -4.871094f, -6.417969f, 26.656250f, 3.236328f, -2.800781f, -15.468750f, 8.609375f, -10.375000f, -1.908203f, -0.970703f, 3.505859f, 1.544922f, 24.828125f, 0.655762f, -17.640625f, 9.382812f, -7.339844f, 11.375000f, 6.621094f, -13.992188f, 9.585938f, 2.585938f, 5.585938f, 6.457031f, 11.234375f, -2.447266f, -10.312500f, 6.988281f, 3.673828f, -10.234375f, 3.781250f, 12.140625f, 10.195312f, 7.355469f, 3.685547f, -7.375000f, 2.603516f, 1.975586f, 1.423828f, -0.800293f, 13.570312f, -9.210938f, 6.324219f, -6.433594f, 10.078125f, -5.199219f, 0.248901f, 0.210205f, -15.875000f, -2.910156f, -16.765625f, 1.877930f, -0.389893f, 3.345703f, 14.265625f, 7.816406f, -18.781250f, 1.777344f, -0.630859f, 23.375000f, 3.246094f, 14.929688f, 1.899414f, -1.970703f, -4.730469f, -6.539062f, -4.132812f, 0.479980f, 7.070312f, 3.089844f, 0.603516f, -0.469482f, 6.910156f, 9.406250f, 6.863281f, 14.250000f, 1.137695f, -3.869141f, -1.564453f, -15.984375f, 5.597656f, 5.566406f, -9.085938f, -6.375000f, -7.246094f, 10.132812f, 15.835938f, -6.687500f, 6.199219f, -8.875000f, -6.468750f, -4.382812f, -8.210938f, 18.203125f, -1.602539f, 1.415039f, -0.548340f, -0.256348f, 10.156250f, -11.242188f, -7.265625f, 12.281250f, -4.113281f, 15.703125f, 6.304688f, -8.421875f, -1.918945f, 4.574219f, 0.452881f, -3.285156f, 1.147461f, -24.937500f, -7.058594f, 17.984375f, -6.062500f, -1.152344f, 10.906250f, -12.179688f, 5.312500f, 7.113281f, 8.710938f, -8.085938f, 1.649414f, 4.859375f, 3.369141f, -5.234375f, 11.359375f, 10.437500f, 4.207031f, -9.906250f, 0.295654f, -1.774414f, -6.269531f, -11.671875f, -13.484375f, 9.851562f, -4.058594f, 12.085938f, -5.855469f, 22.375000f, 15.203125f, -1.832031f, 2.978516f, -14.062500f, 8.960938f, -24.062500f, -5.316406f, 1.110352f, -2.044922f, 11.250000f, -0.441650f, -7.710938f, 4.375000f, -20.250000f, -10.031250f, -2.474609f, 3.988281f, -1.891602f, 2.658203f, 22.921875f, -2.968750f, -16.937500f, 8.351562f, 12.164062f, 0.888184f, -1.564453f, -3.656250f, 4.109375f, 3.027344f, 14.257812f, -7.843750f, 3.150391f, 9.304688f, 5.882812f, 0.300781f, 5.820312f, 0.993652f, -7.113281f, -7.285156f, 14.851562f, -10.890625f, -3.511719f, 6.078125f, 0.290283f, -4.257812f, 6.984375f, 19.140625f, 6.695312f, -1.406250f, -7.148438f, 2.068359f, 0.223511f, -20.203125f, 14.000000f, -19.640625f, -5.089844f, -4.625000f, 10.679688f, 4.214844f, -17.671875f, -7.671875f, 3.904297f, 6.257812f, 4.511719f, 7.218750f, -5.921875f, 16.171875f, 7.179688f, -4.699219f, -20.406250f, 18.281250f, 2.347656f, -24.718750f, -2.281250f, 2.490234f, 3.298828f, -1.105469f, -6.140625f, -7.441406f, 14.726562f, 3.093750f, -4.128906f, -4.726562f, 9.609375f, -16.718750f, 16.218750f, -2.953125f, 12.593750f, -8.906250f, -2.648438f, -5.035156f, -5.753906f, -1.930664f, 8.492188f, 6.421875f, -13.226562f, 6.980469f, -2.369141f, 9.320312f, 10.062500f, -5.363281f, -7.621094f, 2.667969f, -9.085938f, 16.328125f, 9.781250f, -11.546875f, 7.582031f, -4.843750f, -0.751953f, 10.929688f, 3.001953f, -7.722656f, 8.789062f, 2.453125f, 16.437500f, 5.914062f, 7.527344f, 3.392578f, 4.820312f, -9.976562f, 1.294922f, 14.734375f, -6.351562f, 3.595703f, -4.914062f, -1.964844f, -8.218750f, -13.664062f, 4.250000f, -7.476562f, 11.007812f, 7.425781f, -11.812500f, 2.144531f, 9.484375f, 0.803711f, -14.578125f, -20.046875f, 15.828125f, -15.906250f, -5.691406f, 7.757812f, -4.410156f, 5.496094f, -4.074219f, 8.656250f, -24.546875f, -13.398438f, 8.171875f, 2.097656f, 2.025391f, 13.359375f, -1.739258f, 11.914062f, -0.121826f, -15.359375f, 9.039062f, -5.917969f, 29.984375f, 11.000000f, -8.882812f, 0.575684f, 9.570312f, 4.488281f, -7.562500f, 3.041016f, -6.121094f, 8.015625f, -7.574219f, -12.960938f, 3.861328f, 6.898438f, -10.195312f, 7.875000f, 11.906250f, 10.882812f, 6.496094f, -9.750000f, -8.023438f, -13.656250f, -0.966309f, 0.869629f, 13.539062f, -3.150391f, 8.117188f, -3.021484f, 3.701172f, 6.980469f, 1.652344f, -4.878906f, -5.445312f, -4.164062f, 14.203125f, 9.375000f, 14.593750f, -6.734375f, -22.656250f, 5.894531f, 2.789062f, 1.153320f, 16.312500f, -13.679688f, -2.388672f, 5.195312f, -15.375000f, 1.401367f, 10.343750f, 18.890625f, -1.953125f, 12.640625f, -5.835938f, 8.968750f, 9.070312f, -8.406250f, -13.570312f, 0.685547f, 11.539062f, -5.269531f, -3.900391f, -14.851562f, 0.184448f, -0.927734f, -18.703125f, -2.111328f, -5.218750f, 12.101562f, 5.636719f, 12.648438f, -5.105469f, 7.761719f, -6.269531f, -4.515625f, -9.171875f, 13.867188f, 3.240234f, -2.560547f, -8.664062f, 1.476562f, -9.851562f, -9.812500f, -5.730469f, -1.889648f, 21.750000f, 1.995117f, 0.122314f, 3.302734f, 8.054688f, 5.320312f, -0.367920f, 1.373047f, -37.125000f, -3.386719f, -10.617188f, -4.441406f, -9.695312f, -6.050781f, -2.083984f, -8.070312f, -2.750000f, -2.966797f, -3.654297f, 6.066406f, -4.828125f, -19.500000f, 0.844238f, -1.522461f, 8.625000f, 23.375000f, 7.054688f, 12.031250f, 10.960938f, 6.523438f, 2.185547f, -16.703125f, 15.718750f, 3.478516f, 2.794922f, -6.976562f, -8.328125f, -5.406250f, -3.701172f, 1.221680f, 5.972656f, 14.296875f, 8.523438f, -8.960938f, -5.363281f, 6.835938f, 13.046875f, -14.820312f, 1.042969f, 3.013672f, -1.483398f, -5.945312f, 4.300781f, -5.566406f, -11.585938f, -3.539062f, 11.750000f, -4.546875f, -11.031250f, -5.964844f, -12.789062f, 12.796875f, 11.015625f, 8.195312f, 21.312500f, 2.007812f, -8.234375f, 7.769531f, 9.445312f, -5.527344f, 2.027344f, -0.370850f, 2.671875f, -0.531250f, -7.589844f, -14.343750f, 9.976562f, 12.281250f, 7.023438f, -7.464844f, -1.584961f, -4.894531f, 16.484375f, -15.593750f, 2.546875f, 4.546875f, -8.515625f, 5.078125f, -1.478516f, -0.440186f, 0.437012f, -10.789062f, -6.500000f, 5.867188f, 6.632812f, 8.039062f, -13.242188f, 16.593750f, 5.757812f, 29.062500f, -2.060547f }; +static const float16 expected[] = { -1.834961f, 1.436523f, 0.349609f, -0.112793f, -0.078003f, -0.154663f, 15.226562f, -0.414551f, 1.447266f, -1.517578f, 11.804688f, -1.319336f, -0.441162f, -0.532715f, 1.085938f, 1.381836f, -5.234375f, 1.540039f, -0.526367f, 1.136719f, -0.310547f, -0.078613f, 0.866211f, -3.623047f, -1.383789f, -218.625000f, 2.505859f, 1.576172f, 0.872559f, -1.178711f, 0.505371f, 3.119141f, 0.071594f, -1.246094f, -3.652344f, 37.281250f, 0.763672f, -0.877930f, -0.203735f, 0.137451f, -2.552734f, 0.413574f, -0.162720f, -0.030472f, -0.444336f, 3.570312f, 1.161133f, 1.083984f, -0.515625f, -0.407471f, 8.687500f, -1.276367f, 0.692383f, 1.679688f, -0.424561f, 0.352295f, 5.867188f, -2.525391f, 0.337158f, 3.894531f, 0.072510f, 18.171875f, 0.277100f, -1.234375f, 0.856934f, 37.562500f, -6.218750f, 0.074646f, -0.137085f, -0.935547f, -2.068359f, -14.617188f, -1.478516f, -0.566406f, -0.567383f, 0.075134f, 0.852539f, -0.274170f, 3.154297f, -3.220703f, -1.755859f, -0.385986f, 1.746094f, -30.312500f, -1.466797f, 2.921875f, -7.921875f, -0.335449f, 0.484375f, 4.031250f, 0.482910f, -4.261719f, -0.562012f, 2.746094f, 0.459717f, 1.189453f, -0.490723f, 0.577637f, 2.769531f, -0.098022f, 5.898438f, -1.879883f, 1.632812f, 1.355469f, -17.234375f, 1.657227f, 60.656250f, -3.361328f, -0.038208f, 0.879883f, 3.660156f, -0.549805f, 0.778320f, 0.090332f, -1.041992f, -5.171875f, 0.703125f, 1.125000f, -1.216797f, 1.499023f, 0.778809f, 0.057678f, -1.133789f, 0.003544f, -1.207031f, -0.002262f, -1.526367f, 0.094604f, -0.285400f, 1.947266f, -1.409180f, 0.274414f, -0.655273f, 4.914062f, 0.094360f, 1.407227f, -0.296875f, 0.085632f, 0.141479f, -0.464844f, -0.979980f, 48.156250f, 4.632812f, -2.816406f, 0.010262f, 9.062500f, -0.067444f, -0.021042f, 1.436523f, -6.265625f, 0.956055f, -1.471680f, 0.187378f, -0.435303f, -0.989258f, -0.888672f, 1.348633f, -0.072205f, -0.738770f, -2.679688f, 0.456543f, 0.461182f, 0.092712f, -1.769531f, -0.348633f, 0.255615f, 0.741211f, -0.635254f, 17.500000f, -2.253906f, -0.674316f, -0.210205f, 0.083557f, -2.582031f, 0.562500f, -3.416016f, -0.281250f, -5.500000f, -64.875000f, -1.429688f, -1.438477f, -0.928711f, 2.208984f, 0.641602f, 1.225586f, 1.346680f, -0.136230f, -0.165039f, -15.109375f, 0.161011f, 7.144531f, -0.463379f, -0.523438f, -6.867188f, -0.599609f, 1.008789f, -1.931641f, -46.343750f, -1.786133f, -0.346191f, -1.148438f, 3.621094f, -1.500000f, 1.534180f, 2.271484f, -0.383301f, 0.238892f, 5.730469f, -1.073242f, -3.042969f, 3.814453f, 0.472656f, -0.120483f, -14.937500f, 1.829102f, -8.726562f, -16.734375f, 2.507812f, -0.809570f, -9.937500f, -1.585938f, 1.083008f, -4.179688f, 9.906250f, -1.134766f, -0.365723f, -3.767578f, -0.184204f, -2.005859f, 0.163696f, -2.246094f, 1.493164f, -7.246094f, -10.257812f, -0.044525f, -40.343750f, 0.517090f, 0.764160f, -2.785156f, -3.978516f, -0.108704f, -1.756836f, -0.825195f, -39.875000f, 1.842773f, -0.968262f, 2.228516f, -5.859375f, -1.766602f, 1.008789f, -0.168091f, -0.051270f, 0.630371f, -0.736816f, -1.615234f, 0.731934f, 1.450195f, -6.519531f, -2.285156f, -0.750977f, 2.478516f, 0.640137f, -0.226562f, -1.118164f, -1.313477f, -0.947266f, -1.687500f, 3.523438f, 0.943848f, -39.968750f, 0.538086f, -0.025650f, 0.298340f, 0.457275f, -5.312500f, 0.145508f, -0.886719f, -4.386719f, -2.375000f, 1.447266f, 0.577637f, -6.242188f, 0.135254f, 0.617188f, -0.465576f, 1.575195f, -0.418213f, 3.763672f, -0.141113f, 0.035980f, 4.113281f, -0.930664f, -0.654297f, 31.234375f, 0.231079f, -0.562500f, -1.564453f, 0.189819f, -0.261963f, -22.843750f, 3.333984f, -0.894043f, -0.972168f, -1.175781f, 0.363281f, 0.383057f, 0.636230f, -1.467773f, -3.410156f, -4.402344f, -0.341553f, 0.533691f, -2.724609f, 0.892090f, 0.256592f, 0.050781f, -0.604492f, 0.497314f, -0.590332f, -0.202637f, -4.753906f, 0.050201f, 3.169922f, 0.702637f, 5.773438f, 1.609375f, 0.339111f, 1.366211f, 1.019531f, 3.277344f, 0.208984f, -0.017593f, 1.432617f, 1.457031f, 0.101379f, -0.498535f, -3.560547f, 0.293457f, 5.429688f, 0.543457f, -0.608398f, 1.809570f, 57.625000f, 0.103271f, -0.038269f, -1.750977f, 0.085571f, -0.396484f, -0.251709f, -6.117188f, 6.886719f, -0.122192f, 8.523438f, -7.390625f, -0.963379f, -0.144043f, -0.705566f, 0.226074f, 0.195801f, -0.371826f, -0.255127f, -0.338867f, -0.384277f, -0.030487f, 0.349121f, 3.035156f, -1.754883f, 0.251953f, -24.437500f, -1.509766f, -1.168945f, -1.371094f, 0.447754f, 1.765625f, -7.894531f, -0.759277f, 0.323730f, -0.468506f, 0.764648f, 0.531250f, 0.371094f, -0.620605f, -0.134033f, -0.363281f, -5.457031f, 49.843750f, -5.140625f, 3.609375f, 3.755859f, -2.324219f, -7.695312f, -0.008469f, -1.560547f, 1.096680f, -1.331055f, 0.299561f, 9.085938f, -1.215820f, 1.385742f, 0.148071f, 2.041016f, 0.527832f, -0.118530f, 0.390625f, -0.201416f, 1.975586f, 1.157227f, 0.040741f, -0.466797f, -0.464600f, 6.890625f, -0.392334f, -0.367188f, 5.265625f, 4.113281f, 8.054688f, 1.127930f, 1.301758f, -0.107239f, -1.010742f, -0.036835f, -6.000000f, -0.522949f, -0.138184f, 23.968750f, -0.040161f, 0.402588f, -4.339844f, -0.248291f, 0.141968f, -0.121521f, 0.036407f, -0.221558f, -0.690918f, -0.436035f, 1.583008f, -0.895996f, -7.921875f, -4.089844f, -12.328125f, 0.504883f, 0.041779f, 0.216919f, -1.114258f, 3.556641f, -1.034180f, 3.642578f, -1.552734f, 1.091797f, -1.875977f, -0.339355f, 9.218750f, 0.618652f, 4.535156f, -0.882324f, 1.589844f, -6.820312f, -0.894531f, -5.968750f, 0.867676f, -0.347168f, -5.351562f, 4.054688f, 0.678711f, -1.005859f, -0.239380f, -0.850586f, -0.548828f, -6.292969f, -0.997070f, 0.743164f, 0.050812f, 10.062500f, 0.849121f, -0.185181f, -2.369141f, 0.394287f, 1.737305f, 0.291260f, -0.400635f, 0.561035f, -2.406250f, -1.040039f, -0.560059f, -0.191406f, -0.730469f, 118.187500f, -1.958008f, 0.546387f, 0.097595f, 0.801758f, 248.375000f, -0.006920f, 2.976562f, -6.015625f, -1.276367f, 2.000000f, 2.398438f, -0.783691f, 2.683594f, 0.898926f, 0.679199f, 12.195312f, -1.201172f, 1.318359f, -0.571777f, -4.617188f, -1.972656f, -0.275879f, 14.742188f, -0.645508f, -4.527344f, -0.152954f, -2.318359f, 7.390625f, 0.282471f, -0.123779f, 0.525879f, -1.350586f, -0.267822f, -0.156128f, 0.743164f, -1.801758f, -3.458984f, -0.771484f, 0.366455f, 0.784668f, 1.647461f, 0.861816f, 0.163208f, 0.357178f, -0.251953f, 1.486328f, -0.867676f, -4.011719f, 1.504883f, -12.539062f, 1.921875f, 0.830078f, -0.738770f, 6.500000f, -0.991211f, -17.718750f, 0.780273f, 0.166260f, -1.834961f, -5.574219f, 0.655273f, 1.222656f, -1.306641f, -3.371094f, 7.250000f, -0.431885f, -1.016602f, 7.628906f, 64.125000f, 5.671875f, -1.152344f, -6.441406f, 0.203247f, -0.390381f, -0.567383f, -0.773438f, -10.875000f, 0.164551f, -0.747559f, 8.601562f, -0.107666f, -0.108826f, 0.853027f, -0.359131f, 1.644531f, -2.931641f, 0.807129f, 0.178833f, 54.718750f, -0.125854f, -0.266602f, 1.687500f, 19.453125f, 2.042969f, -12.531250f, 0.067627f, 0.137573f, -4.347656f, -2.359375f, 16.578125f, 17.328125f, -0.001959f, 2.697266f, -1.709961f, 0.430176f, -11.617188f, 2.453125f, 0.341064f, 0.330566f, -0.274902f, 16.906250f, -0.247925f, 0.156494f, 1.022461f, 0.832031f, 0.285400f, -0.513184f, -1.681641f, -0.743164f, -0.108215f, 2.300781f, -7.019531f, 0.820312f, -2.980469f, 1.416992f, -0.043701f, 0.773926f, 0.362549f, -2.351562f, -5.843750f, 0.791504f, 3.363281f, 0.836426f, 0.210205f, -1.271484f, 0.782227f, 1.171875f, 1.770508f, 0.838867f, 0.893555f, -11.625000f, 1.063477f, 1.465820f, -1.055664f, -13.812500f, -0.704102f, 0.203979f, 1.227539f, -0.670898f, -0.768555f, -0.512207f, -1.862305f, -0.729004f, -0.012169f, 4.070312f, 0.172363f, -2.656250f, -1.259766f, -4.023438f, -1.246094f, 1.329102f, -1.404297f, 1.073242f, 1.415039f, 0.606445f, -3.861328f, 0.441406f, -0.007843f, 0.462158f, 0.484863f, -0.300049f, 0.874512f, 0.335938f, -0.001779f, -5.050781f, 1.561523f, -0.512695f, -38.812500f, -0.217651f, -0.202026f, -7.535156f, 8.671875f, -2.685547f, -0.438477f, -1.744141f, -10.898438f, 1.416992f, 1.658203f, 0.348145f, -18.078125f, 0.733398f, 1.790039f, -1.111328f, -0.275879f, 0.001069f, -1.837891f, 26.390625f, 16.437500f, 0.101074f, 1.070312f, 1.665039f, -1.284180f, 0.487305f, 2.472656f, 0.750488f, 2.095703f, 12.437500f, -1.801758f, -23.406250f, -1.778320f, 0.054382f, 1.475586f, -4.769531f, -2.568359f, -1.414062f, -2.564453f, 2.669922f, -1.140625f, 0.082703f, 0.619141f, 4.960938f, -0.476318f, 0.514160f, -12.164062f, -0.157715f, 0.548340f, 0.400146f, -1.610352f, -3.044922f, -12.328125f, 7.367188f, 2.595703f, 1.961914f, 0.604492f, 3.277344f, -1.756836f, -1.554688f, 7.972656f, 0.887207f, -0.286621f, -1.615234f, -2.810547f, 4.195312f, 12.835938f, 1.371094f, 2.457031f, 2.087891f, -9.484375f, 8.773438f, -0.383057f, 0.441650f, -3.544922f, 0.086914f, -0.173340f, -0.536621f, 1.413086f, -0.530762f, 0.269043f, 1.140625f, -1.080078f, 0.636719f, 0.759766f, 0.223511f, 0.715332f, -117.812500f, 0.338867f, 0.106689f, -0.732910f, 4.679688f, -1.239258f, 1.344727f, 0.953613f, -1.297852f, 1.013672f, -0.347168f, 0.310547f, 0.884277f, -1.356445f, 1.421875f, 1.943359f, 2.876953f, -0.355957f, 1.008789f, -0.771484f, 5.914062f, 0.409424f, -4.183594f, 0.323242f, -0.257324f, -0.046509f, -0.447754f, -1.031250f, -1.341797f, -1.024414f, -25.625000f, 0.403564f, 4.859375f, 0.848145f, 1.239258f, -0.756348f, -3.837891f, 0.104614f, -1.912109f, -51.062500f, 5.183594f, 0.575684f, -2.173828f, 0.937500f, 1.404297f, 1.401367f, -1.826172f, -1.696289f, 0.044434f, 0.833008f, -35.156250f, -4.738281f, -0.014740f, -1.171875f, 0.834961f, 3.990234f, -0.426758f, 1.706055f, -2.158203f, -0.530762f, 0.149292f, -1.551758f, 1.015625f, -0.868652f, -1.916016f, -2.843750f, 1.416016f, -79.250000f, -0.416016f, -9.742188f, -4.343750f, 0.793457f, -0.083374f, 1.349609f, -2.210938f, 0.328857f, 3.269531f, 0.163940f, -0.004505f, -0.232910f, -0.629395f, 0.380615f, -0.233643f, -0.250977f, 0.419189f, -2.460938f, 0.568359f, 2.437500f, 2.978516f, -0.563477f, -0.599121f, 2.732422f, 1.418945f, 0.992188f, -0.102234f, 2.367188f, -0.379639f, 0.976074f, -1.277344f, -4.410156f, 0.698730f, -0.925293f, 0.708984f, 1.615234f, 1.375977f, 4.351562f, -0.071777f, -79.812500f, -2.193359f, -0.851074f, 2.521484f, 0.877930f, -0.687012f, 3.392578f, -4.585938f, -19.281250f, 2.431641f, -0.929688f, -0.121643f, 0.673340f, 0.304443f, -0.057526f, 1.274414f, -0.624023f, -11.101562f, 0.962402f, -0.339355f, 8.312500f, 1.250000f, 0.868164f, -0.075439f, -4.246094f, 4.667969f, -0.795410f, 0.953125f, -0.824707f, -0.959473f, -0.634277f, 34.468750f, -0.822754f, -1.293945f, 1.005859f, -1.668945f, 1.174805f, -0.831543f, 0.298584f, -1.656250f, -0.508789f, -3.916016f, 0.111633f, -34.718750f, -1.651367f, 2.015625f, -0.181396f, 4.210938f, -0.429688f, -1.136719f, 0.123474f, -9.203125f, -0.946289f, 2.900391f, -0.803223f, -1.292969f, 0.111633f, 0.754395f, -0.810059f, -3.808594f, 67.187500f, -0.995117f, -0.061584f, -0.531738f, -0.933105f, 2.755859f, 0.514648f, 8.007812f, 5.871094f, 6.257812f, -39.937500f, 0.877441f, -1.583984f, 1.253906f, 0.154053f, 10.976562f, -3.330078f, -0.045135f, -1.203125f, 2.541016f, -23.718750f, 4.945312f, -0.165161f, -0.706055f, -3.357422f, 1.162109f, -4.972656f, 0.212036f, -0.489746f, 3.095703f, -18.578125f, 0.403076f, -1.834961f, 2.533203f, 2.949219f, 3.806641f, -2.585938f, 0.732422f, 0.673340f, -0.479980f, -2.947266f, 51.156250f, -0.400146f, -0.445068f, -1.071289f, -0.687500f, -0.438477f, 0.728027f, 0.558594f, 0.458984f, 1.305664f, -1.154297f, 0.771973f, -1.187500f, -0.295898f, -0.805664f, -1.049805f, 0.796875f, 0.009918f, 0.778320f, 0.681641f, 3.048828f, -3.343750f, 0.458252f, -0.311523f, -2.017578f, 0.405273f, -5.386719f, -2.187500f, -0.597168f, -1.669922f, -0.369629f, 0.860352f, 0.081177f, -4.195312f, 0.875977f, 0.128906f, 0.302734f, 0.720215f, 12.335938f, 0.422852f, 0.617676f, -1.402344f, 2.791016f, 0.847168f, 1.572266f, 2.935547f, -15.750000f, 1.342773f, -0.620117f, -0.113525f, 0.183350f, -0.574707f, -1.980469f, -0.969238f, 1.468750f, 0.319336f, -0.638184f, -0.306641f, -0.013359f, -0.431152f, 0.033478f, -0.469971f, -1.033203f, -17.640625f, -0.256348f, 0.684570f, -0.027527f, 0.105408f, -1.733398f, 0.817871f, -2.179688f, 0.687988f, -0.149902f, -0.027359f, 3.603516f, -10.265625f, 2.939453f, 29.250000f, -1.046875f, 1.251953f, 0.212769f, -7.343750f, 1.470703f, 0.053680f, -0.161743f, 0.823242f, -1.950195f, -0.107544f, 3.931641f, -2.181641f, 0.549316f, -0.433105f, 0.604980f, -2.187500f, -1.524414f, 2.185547f, -0.553223f, -1.382812f, 1.151367f, -12.054688f, 3.898438f, -0.367432f, -1.154297f, -0.047852f, -0.169800f, -2.306641f, 3.201172f, 0.029037f, -0.327148f, -1.681641f, -2.558594f, -0.310303f, 111.062500f, -0.597168f, -1.969727f, -2.208984f, 0.149780f, -0.534668f, 0.399414f, -0.353760f, -10.843750f, 34.281250f, 6.347656f, 3.652344f, -0.510742f, 0.540527f, -1.592773f, 1.929688f, -0.317383f, -0.353516f, 1.022461f, -2.923828f, -1.315430f, 0.019135f, -6.027344f, 0.476562f, -0.416504f, -32.687500f, 0.100220f, -0.500488f, -1.048828f, 12.492188f, -21.546875f, 5.773438f, 1.677734f, -1.750000f, -2.066406f, -2.107422f, -1.684570f, -0.300049f, -1.282227f, 0.528320f, 3.173828f, 1.522461f, 1.009766f, 0.708496f, -0.886719f, 2.599609f, 0.288330f, 0.324219f, -0.302246f, 0.203613f, 0.029434f, -0.915527f, -4.179688f, -0.982910f, 0.201782f, 0.388184f, 0.423340f, 0.052063f, -2.779297f, 3.664062f, -2.074219f, 0.486816f, -0.617676f, -2.562500f, 3.533203f, 0.923340f, 7.539062f, -0.782227f, -4.152344f, 8.304688f, -6.804688f, -14.679688f, -0.142822f, 0.551758f, -4.800781f, -0.361572f, 0.306152f, -1.459961f, 0.026245f, -9.117188f, 2.154297f, -0.268799f, 1.000000f, 0.700195f, -54.812500f, -0.726074f, -2.041016f, 8.812500f, -0.870117f, 0.720215f, 0.163086f, -4.007812f, -18.718750f, -13.007812f, 15.046875f, 1.394531f, 2.417969f, 0.662109f, 0.888672f, 2.783203f, 2.990234f, 1.625977f, -1.072266f, 0.584961f, -0.016678f, 0.636719f, -0.294434f, 1.918945f, -2.152344f, 0.150269f, -4.875000f, -49.343750f, 0.065979f, 2.095703f, 1.728516f, 4.257812f, -0.507812f, -0.444580f, -2.009766f, 0.121765f, -24.937500f, -1.615234f, 0.935059f, -2.835938f, -1.455078f, -3.466797f, -1.398438f, -3.757812f, -0.218750f, -0.535645f, 0.055542f, 0.271240f, 0.020340f, -0.084167f, -2.707031f, 1.665039f, -0.579102f, 0.623535f, -1.550781f, 1.151367f, -2.546875f, -2.710938f, -0.616699f, -0.744629f, -0.599609f, -0.309570f, 0.913086f, 0.712891f, -0.020920f, -0.311768f, -0.483887f, -1.114258f, 2.695312f, 0.199341f, -0.711426f, -1.133789f, 3.212891f, -15.625000f, 0.976562f, -0.718750f, -0.946777f, 2.066406f, 9.554688f, -0.887695f, 38.562500f, 0.836426f, -11.257812f, -0.817383f, 1.622070f, 3.583984f, -9.054688f, 0.300781f, -0.744141f, 53.437500f, -0.815918f, -0.167358f, -1.643555f, 3.566406f, -0.810547f, -0.198486f, -2.708984f, -0.302734f, 0.441650f, -2.982422f, 2.328125f, 0.288818f, -0.767578f, 0.014763f, -0.513672f, -0.066162f, 1.583008f, 2.718750f, -0.034027f, -4.710938f, -33.312500f, -0.541992f, 0.494629f, -0.045013f, -199.250000f, -1.546875f, -0.459717f, -3.373047f, -1.671875f, -1.285156f, 2.136719f, 0.622559f, 0.466553f, -0.207642f, -0.966309f, -0.182251f, -1.904297f, -0.549316f, -2.255859f, -0.825195f, -0.998535f, 2.505859f, -2.123047f, -0.129150f, -0.063171f, 0.040863f, 0.440186f, 0.749512f, 6.546875f, -1.118164f, -2.158203f, -4.894531f, 0.267822f, 0.371338f, 12.257812f, -1.686523f, -0.812012f, 0.104919f, -0.363037f, -0.066162f, -1.368164f, -1.835938f, 0.591309f, -2.830078f, -0.933105f, -2.074219f, 0.466553f, -2.371094f, 0.822754f, 1.856445f, -1.160156f, 1.161133f, 1.194336f, 0.716797f, -2.988281f, -1.153320f, -1.435547f, -0.727539f, 1.467773f, -1.813477f, 0.350342f, -0.829102f, -0.727051f, 0.127319f, -1.684570f, 11.898438f, -1.125977f, -2.224609f, 1.971680f, -2.074219f, 4.070312f, 1.150391f, 0.243896f, -5.847656f, 0.340332f, -1.074219f, -1.191406f, 10.859375f, 1.559570f, 0.272705f, 0.471436f, 0.492432f, -2.689453f, -0.167725f, 0.180786f, 92.500000f, 2.673828f, 0.125244f, -0.451660f, 5.460938f, -2.732422f, -3.107422f, 2.916016f, -0.929199f, -0.061249f, 0.443848f, 0.101074f, 9.343750f, -1.181641f, -0.610352f, -3.261719f, -3.751953f, -1.268555f, 0.735840f, 2.513672f, 1.902344f, -3.230469f, 1.206055f, -6.335938f, -0.904785f, 0.645020f, -0.106628f, -0.784668f, 0.172363f, -0.496582f, 0.510742f, -2.019531f, 2.824219f, -34.812500f, 1.166016f, -3.361328f, 0.438232f, 3.625000f, -6.046875f, 0.159546f, 1.431641f, 4.183594f, 1.799805f, 0.457520f, -3.039062f, 3.214844f, 0.760742f, 1.693359f, 0.181274f, -0.372070f, 0.273926f, 2.880859f, 1.367188f, -1.467773f, 2.662109f, 0.865234f, -3.958984f, -0.137573f, 1.647461f, 0.672852f, 2.105469f, 0.365967f, -3.650391f, 0.377441f, 1.445312f, -60.343750f, -0.430664f, -0.034943f, 0.354248f, 0.047180f, -0.140503f, -3.169922f, 0.084656f, -0.856445f, -0.483398f, 0.068481f, 0.601074f, 10.664062f, 0.459473f, -0.906738f, 82.750000f, -1.208984f, -1.009766f, -0.097412f, 1.158203f, -3.425781f, 0.384277f, -0.052856f, -2.333984f, 0.810059f, -1.124023f, -0.323730f, -0.345947f, 0.090942f, -1.007812f, -3.087891f, -0.997559f, -1.222656f, -1.450195f, 0.080811f, -0.139526f, -0.409180f, -0.961426f, 1.153320f, 0.011955f, 1.453125f, -0.518066f, 123.000000f, -2.867188f, 3.496094f, 3.738281f, 0.215698f, 1.637695f, -3.583984f, -3.134766f, 50.250000f, 2.416016f, 39.968750f, 0.398438f, 0.004120f, 14.781250f, -1.603516f, -0.515625f, 6.328125f, -20.593750f, 1.038086f, -0.180176f, -2.414062f, -2.185547f, 3.980469f, 0.136353f, -0.972656f, 2.429688f, 2.515625f, 2.292969f, -3.789062f, 0.919922f, -1.552734f, -1.327148f, -4.949219f, -0.078857f, 0.058289f, -0.144531f, -1.797852f, -0.078918f, -0.010002f, 2.937500f, 1.989258f, -0.546387f, 0.179810f, 0.147583f, -0.844238f, 1.026367f, -0.602539f, -0.315186f, 2.486328f, -0.166626f, -20.578125f, -0.621582f, -1.058594f, -0.542969f, -1.153320f, 0.447510f, -2.218750f, -2.257812f, -0.595215f, 0.814941f, -0.197632f, -2.310547f, -0.189453f, 0.950195f, 0.702637f, 4.464844f, 1.343750f, 0.641113f, -1.020508f, -14.968750f, -0.463379f, 0.325684f, 0.611328f, 0.189819f, -8.914062f, -0.114685f, 0.153198f, 0.281250f, -0.903320f, 0.513672f, 9.789062f, -0.286621f, -1.073242f, 2.044922f, -0.789551f, 0.193359f, 0.494141f, 32.031250f, -1.573242f, 1.433594f, -1.454102f, -1.696289f, 4.980469f, 4.917969f, -0.793945f, -2.460938f, -0.078491f, 0.652832f, -19.390625f, -0.756836f, 0.300293f, -1.465820f, -0.867188f, 10.328125f, 0.769043f, -0.554199f, -3.806641f, -2.103516f, -1.667969f, 0.377686f, -1.274414f, -2.906250f, 0.389160f, 2.371094f, -1.143555f, -0.613281f, 9.351562f, -1.357422f, -9.703125f, -0.175781f, 16.390625f, 0.390137f, -0.043518f, 2.011719f, -1.387695f, -0.018723f, 0.994629f, -0.763672f, 1.577148f, 0.477295f, 0.770020f, 0.140259f, 3.830078f, -0.956055f, 0.049408f, 1.674805f, -0.719727f, -0.585938f, -1.121094f, 0.099060f, -1.836914f, 3.281250f, -0.161377f, -2.173828f, 2.832031f, -13.648438f, -21.781250f, -0.594238f, 0.754883f, -1.658203f, -1.391602f, -0.233276f, 1.279297f, -36.875000f, -13.117188f, -0.179077f, -2.361328f, 0.608398f, 8.937500f, 2.634766f, -3.656250f, 0.175903f, -0.149536f, -0.218384f, 1.147461f, -8.164062f, 0.603516f, 0.412354f, 0.833984f, 14.132812f, -5.906250f, -0.528320f, -0.094788f, 1.771484f, 20.796875f, -1.127930f, 3.482422f, -36.593750f, 23.109375f, -1.068359f, 0.684082f, -0.196167f, 1.002930f, -10.539062f, -2.746094f, 2.275391f, -0.249878f, -2.162109f, -1.676758f, -0.180176f, 0.614258f, -2.048828f, 0.973145f, -1.112305f, 0.823242f, 3.464844f, -1.210938f, -0.396484f, 6.144531f, -0.155273f, 0.212158f, -0.166382f, 9.140625f, 15.718750f, -47.375000f, -1.163086f, -0.022522f, 1.438477f, -0.142944f, 1.630859f, 0.741699f, 0.705078f, -0.399658f, -0.191895f, -1.035156f, 8.695312f, -4.875000f, -9.406250f, 0.509766f, 0.237183f, 0.978516f, -1.476562f, 14.890625f, 0.421143f, 0.536621f, 0.112305f, -1.555664f, -0.098389f, -0.999023f, -2.496094f, 2.111328f, -3.810547f, 2.595703f, -0.012360f, 0.522461f, 3.822266f, -1.846680f, -17.562500f, -1.206055f, 1.082031f, -0.713379f, -0.914062f, 0.235474f, 1.839844f, -1.298828f, 1.578125f, 0.083496f, -1.160156f, -1.667969f, -7.574219f, -1.103516f, 1.087891f, 0.803711f, -0.697266f, -3.802734f, -3.507812f, -0.189209f, 1.252930f, -0.784180f, 2.455078f, -0.023987f, 0.693359f, -1.444336f, 5.171875f, -5.433594f, 3.617188f, 0.153076f, 1.087891f, 0.137329f, -2.166016f, -0.363281f, 2.878906f, 2.050781f, 1.614258f, 1.044922f, -5.257812f, -0.018082f, 2.244141f, 0.093140f, -1.428711f, -1.969727f, 15.976562f, 0.327148f, -0.342529f, 0.038300f, -0.184204f, 0.185425f, -0.380859f, 3.339844f, -2.869141f, -6.062500f, -0.455566f, -0.886230f, 0.178833f, 0.188599f, -14.812500f, 0.185059f, -1.031250f, -63.937500f, -0.579102f, -1.078125f, 0.328613f, 1.855469f, -1.620117f, -1.239258f, -0.732422f, 0.506348f, -3.554688f, 4.460938f, 0.592285f, -0.925781f, 0.933594f, -2.511719f, -0.585449f, -0.643555f, -4.066406f, -0.007748f, 0.001475f, -0.756836f, 0.029099f, -0.418701f, -2.175781f, -2.373047f, -8.179688f, 1.564453f, -0.865234f, 0.312744f, -2.220703f, -3.894531f, -0.784668f, 0.031433f, 0.041656f, -0.043457f, 2.416016f, -1.066406f, 0.267090f, -1.607422f, 3.384766f, 1.684570f, 1.717773f, -1.100586f, -0.315430f, 0.413818f, -0.093872f, 3.357422f, -0.067139f, 0.462402f, -3.160156f, -0.678223f, -5.015625f, -1.749023f, -0.197144f, 0.102722f, -1.044922f, 0.625488f, -0.346680f, 16.390625f, -0.551270f, 3.748047f, -1.300781f, 0.031799f, -9.257812f, -0.788574f, 0.389404f, -1.746094f, -2.099609f, -4.410156f, -0.742676f, 1.971680f, -0.829102f, -1.975586f, 5.945312f, -0.228149f, 8.648438f, 1.045898f, 0.400879f, -1.857422f, -0.874023f, 0.970215f, -1.372070f, -1.174805f, -6.894531f, -0.354492f, 9.515625f, -0.533691f, -0.212402f, -1.420898f, -0.396240f, -1.983398f, 0.739258f, 2.652344f, -3.898438f, 3.216797f, 0.784668f, -0.089355f, 0.612793f, -1.472656f, 6.300781f, -4.757812f, -1.060547f, -0.231323f, -0.041473f, -0.244019f, 0.198730f, 1.276367f, -2.896484f, 0.220703f, 2.603516f, -1.004883f, 13.109375f, 1.448242f, -2.167969f, 1.158203f, 3.875000f, 2.388672f, -0.464111f, 1.028320f, -0.698730f, 0.416748f, -0.212891f, -0.435303f, -0.910645f, -0.140137f, -0.280029f, 0.438477f, -0.594238f, 2.181641f, -0.414795f, -1.879883f, -14.023438f, -0.118958f, -3.236328f, 0.173584f, -0.167725f, 1.188477f, -1.124023f, 3.314453f, 4.949219f, 0.775391f, -2.142578f, -0.233521f, 1.743164f, -0.187256f, 0.279541f, 0.123047f, 3.156250f, 0.838379f, 4.968750f, -0.660156f, -0.197144f, -0.629883f, -2.876953f, 0.393799f, -3.808594f, -0.276367f, -0.157715f, 0.880371f, 0.827148f, 0.201416f, 0.000152f, 0.200562f, 1.005859f, 0.593750f, 17.890625f, -0.500488f, -2.662109f, 0.927246f, -0.678223f, 61.281250f, 1.409180f, 0.498291f, -2.347656f, 2.416016f, 0.176392f, -1.748047f, -0.005047f, -2.009766f, -0.429199f, 1.181641f, -2.539062f, -0.053131f, 1.112305f, 0.461670f, -0.088257f, 0.294434f, 5.117188f, -0.818359f, -1.114258f, -2.314453f, -3.378906f, 0.365479f, -3.250000f, 135.750000f, 1.856445f, -0.360107f, -1.295898f, -11.921875f, 9.539062f, -0.066589f, -0.256104f, -1.118164f, 2.486328f, -0.844238f, 0.314941f, 9.570312f, -0.368896f, -1.446289f, -1.483398f, -0.638184f, -0.339600f, -0.279053f, -0.836426f, -6.886719f, 4.132812f, -0.417725f, -0.363281f, -1.579102f, -0.463379f, -1.058594f, -0.177734f, -4.121094f, 0.990723f, -0.503418f, -1.002930f, -1.759766f, 1.108398f, 0.761719f, -1.303711f, -1.639648f, -2.330078f, -0.595215f, -0.337402f, -0.147461f, -0.596191f, -1.867188f, -1.699219f, -1.113281f, -0.746582f, -15.257812f, 3.205078f, -2.070312f, 0.663574f, -6.667969f, -0.670898f, 1.027344f, 2.865234f, 2.083984f, 1.162109f, -0.495117f, -1.305664f, -0.690918f, -0.405029f, -0.081543f, -1.565430f, -0.137207f, 1.066406f, -1.596680f, 2.853516f, -1.115234f, -1.045898f, -1.092773f, -32.281250f, 1.169922f, -43.218750f, 2.531250f, -1.029297f, 1.097656f, -0.703125f, -2.697266f, 0.727539f, 2.548828f, 0.506348f, -0.394287f, -0.147339f, -4.785156f, -1.270508f, 0.784668f, -0.769043f, -11.859375f, -1.742188f, -13.335938f, -0.050690f, 1.870117f, 1.350586f, -1.129883f, -0.757324f, 1.589844f, 0.798340f, 3.437500f, 0.340820f, 2.291016f }; + +#endif /* DATA_H_ */ diff --git a/tests/spatz_on_magia/onnx_div/test_data/generator.py b/tests/spatz_on_magia/onnx_div/test_data/generator.py new file mode 100644 index 00000000..6139a886 --- /dev/null +++ b/tests/spatz_on_magia/onnx_div/test_data/generator.py @@ -0,0 +1,88 @@ +import os +import sys +import numpy as np +import onnx +import onnxruntime as ort +from onnx import helper, TensorProto + +def parse_args(): + if len(sys.argv) != 2: + print("Error: missing argument ") + print("Usage: python3 generator.py ") + sys.exit(1) + + try: + length = int(sys.argv[1]) + except ValueError: + print("Error: must be an integer") + print("Usage: python3 generator.py ") + sys.exit(1) + + return length + +def generate_operands(length): + a = (np.random.randn(length) * 10).astype(np.float16) + b = (np.random.randn(length) * 10).astype(np.float16) + + # avoid 0 and Inf or NaN + epsilon = 1e-3 + a[a==0] += epsilon + b[b==0] += epsilon + a[~np.isfinite(a)] = 1.0 + b[~np.isfinite(a)] = 1.0 + + return a, b + + +def run_onnx_div(vec_a, vec_b): + a_info = helper.make_tensor_value_info('A', TensorProto.FLOAT16, vec_a.shape) + b_info = helper.make_tensor_value_info('B', TensorProto.FLOAT16, vec_b.shape) + out_info = helper.make_tensor_value_info('Quot', TensorProto.FLOAT16, vec_a.shape) + + node_def = helper.make_node('Div', ['A', 'B'], ['Quot']) + graph_def = helper.make_graph( + [node_def], + 'onnx-div-test', + [a_info, b_info], + [out_info] + ) + model_def = helper.make_model(graph_def, producer_name='onnx-generator') + + sess = ort.InferenceSession(model_def.SerializeToString()) + res = sess.run(None, {'A': vec_a, 'B': vec_b}) + + return res[0] + +def format_array(array): + return "{ " + ", ".join(f"{x:f}f" for x in array) + " }" + +def generate_header_file(length, vec_a, vec_b, expected, filename="data.h"): + + script_dir = os.path.dirname(os.path.abspath(__file__)) + filepath = os.path.join(script_dir, filename) + + with open(filepath, "w") as f: + f.write("/* Automatically generated header file for Spatz ONNX testing */\n") + f.write("#ifndef DATA_H_\n") + f.write("#define DATA_H_\n\n") + + f.write(f"#define LEN {length}\n\n") + + f.write(f"static const float16 vec_a[] = {format_array(vec_a)};\n") + f.write(f"static const float16 vec_b[] = {format_array(vec_b)};\n") + f.write(f"static const float16 expected[] = {format_array(expected)};\n\n") + + f.write("#endif /* DATA_H_ */\n") + +def main(): + length = parse_args() + + vec_a, vec_b = generate_operands(length) + expected = run_onnx_div(vec_a, vec_b) + + generate_header_file(length, vec_a, vec_b, expected) + + print(f"File 'data.h' successfully generated with {length} elements.") + +if __name__ == "__main__": + main()