Skip to content

Instantly share code, notes, and snippets.

View nibrunieAtSi5's full-sized avatar

Nicolas Brunie nibrunieAtSi5

View GitHub Profile
@nibrunieAtSi5
nibrunieAtSi5 / random_fp_visualizer.py
Last active January 2, 2024 19:08
Random Floating-Point values 2D visualizer (multi-value support)
# Usage:
# ./testfloat_gen -level1 f16_to_f32_mulAdd | head -n 10000 | python3 ~/MiscScripts/random_fp_visualizer.py "FP16 FP16 FP32 FP32"
from sys import stdin
import matplotlib.pyplot as plt
import argparse
# this script expects to read from <stdin> BF16 values
# encoded in hexadecimal, e.g.:
# DE00
@nibrunieAtSi5
nibrunieAtSi5 / test_bf16_to_f32.c
Created October 12, 2023 19:30
Basic sanity test for softfloat bf16_to_f32
/** Minimal sanity test for softfloat bf16_to_f32 function
*
* build:
* gcc test_bf16_to_f32.c softfloat.a -Isource/include/ -o test_bf16_to_f32
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
#include "internals.h"
@nibrunieAtSi5
nibrunieAtSi5 / test_f32_to_bf16.c
Created October 12, 2023 18:21
softfloat-3 test bench for BF16 f32_to_bf16
/**
* build:
* gcc test_f32_to_bf16.c softfloat.a -Isource/include/ -o test_f32_to_bf16
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
#include "internals.h"
#include "softfloat.h"