Skip to content

Instantly share code, notes, and snippets.

View saimachi's full-sized avatar

saimachi

View GitHub Profile
///////////////////////////////////////////////////////////////////////////////
// Author: Sai Machiraju
// Course: ECE8893 - Parallel Programming for FPGAs
// Filename: real_matmul.cpp
// Description: Perform matrix multiplication with real values
//
// Note: You are free to modify this code to optimize your design.
///////////////////////////////////////////////////////////////////////////////
#include "real.h"
@saimachi
saimachi / matmul.py
Last active February 10, 2024 18:47
import numpy as np
import pynq
overlay = pynq.Overlay('matmul.bit')
top_ip = overlay.real_matmul_0
a_matrix = np.random.randint(10, size=(100, 150))
b_matrix = np.random.randint(10, size=(150, 200))
+---------------------------------------------------------------------------------------+------+------+---------+-----------+----------+---------+------+----------+---------+-----------+-------------+-------------+-----+
| Modules | Issue| | Latency | Latency | Iteration| | Trip | | | | | | |
| & Loops | Type | Slack| (cycles)| (ns) | Latency | Interval| Count| Pipelined| BRAM | DSP | FF | LUT | URAM|
+---------------------------------------------------------------------------------------+------+------+---------+-----------+----------+---------+------+----------+---------+-----------+-------------+-------------+-----+
|+ real_matmul | -| 0.00| 787647| 7.876e+06| -| 7
+---------------------------------------------------------+------+------+---------+-----------+----------+---------+-------+----------+----------+---------+-----------+-----------+-----+
| Modules | Issue| | Latency | Latency | Iteration| | Trip | | | | | | |
| & Loops | Type | Slack| (cycles)| (ns) | Latency | Interval| Count | Pipelined| BRAM | DSP | FF | LUT | URAM|
+---------------------------------------------------------+------+------+---------+-----------+----------+---------+-------+----------+----------+---------+-----------+-----------+-----+
|+ real_matmul | -| 0.00| 3310043| 3.310e+07| -| 3310044| -| no| 82 (29%)| 6 (2%)| 2026 (1%)| 2923 (5%)| -|
| + real_matmul_Pipeline_MAT_A_ROWS_MAT_A_COLS | -| 0.00| 15004| 1.50
///////////////////////////////////////////////////////////////////////////////
// Author: <>
// Course: ECE8893 - Parallel Programming for FPGAs
// Filename: real_matmul.cpp
// Description: Perform matrix multiplication with real values
//
// Note: You are free to modify this code to optimize your design.
///////////////////////////////////////////////////////////////////////////////
#include "real.h"
{
"input_model": {
"type": "PyTorchModel",
"config": {
"hf_config": {
"model_name": "model-cache/microsoft/phi-1_5",
"task": "text-generation",
"model_loading_args": {
"trust_remote_code": true
}
import csv
import json
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('microsoft/phi-1_5')
prompt_str = '### Wikipedia comment: {text}\n### Classifications:\n{classifications}'
if __name__ == '__main__':
# JSONL format
output = []
@saimachi
saimachi / PepsiCo.ipynb
Last active December 25, 2023 02:22
saimachi.dev PepsiCo Blog
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.