From b3c9cc185f52ca116892085b005a9bc7fb34d0c1 Mon Sep 17 00:00:00 2001 From: Aakarsh Kashyap Date: Tue, 31 Mar 2026 01:23:26 +0530 Subject: [PATCH 1/4] Data access error in ReLU function --- 4 | 29 +++++++++++++++++++++++++++++ coldstart/.env | 1 + src/backend_cpu/math/relu.cpp | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 4 create mode 100644 coldstart/.env diff --git a/4 b/4 new file mode 100644 index 0000000..6d85090 --- /dev/null +++ b/4 @@ -0,0 +1,29 @@ +#include "internal_header.h" + + +tensor_t *tensor_relu(tensor_pool_t *pool, tensor_t *x) { + assert(pool != NULL); + assert(x != NULL); + + tensor_t *t = tensor_dtype_create(pool, x->dtype, x->ndims, x->dims, NULL); + + t->op = tensor_op_t::RELU; + t->a = x; + t->b = NULL; + return t; +} + +bool tensor_op_relu(tensor_pool_t *pool, tensor_t *t) { + // TODO: Once again remainder to support different dtype cause it's just a prop with only float for now + assert(pool != NULL); + assert(t != NULL); + + float* float_data = ((float*)(t->a->data)); + + for(uint32_t i = 0; i < t->nvalues; i++) { + if (float_data[i] < 0) { + float_data[i] = 0; + } + } + return true; +} diff --git a/coldstart/.env b/coldstart/.env new file mode 100644 index 0000000..cef9088 --- /dev/null +++ b/coldstart/.env @@ -0,0 +1 @@ +GEMINI_API_KEY=AIzaSyA8KDqfeAfpnx9qEK4td3BOxn3R9721fvw diff --git a/src/backend_cpu/math/relu.cpp b/src/backend_cpu/math/relu.cpp index dda46cf..6d85090 100644 --- a/src/backend_cpu/math/relu.cpp +++ b/src/backend_cpu/math/relu.cpp @@ -18,7 +18,7 @@ bool tensor_op_relu(tensor_pool_t *pool, tensor_t *t) { assert(pool != NULL); assert(t != NULL); - float* float_data = ((float*)(t->data)); + float* float_data = ((float*)(t->a->data)); for(uint32_t i = 0; i < t->nvalues; i++) { if (float_data[i] < 0) { From a077c9686eb39d5fcfa41c84501ba34b821f0af6 Mon Sep 17 00:00:00 2001 From: Aakarsh Kashyap Date: Tue, 31 Mar 2026 01:29:24 +0530 Subject: [PATCH 2/4] remove .env from tracking --- coldstart/.env | 1 - coldstart/.gitignore | 1 + coldstart/coldstart.prev | 0 coldstart/coldstart.sh | 24 ++++++++++++++ coldstart/coldstart_agent.py | 29 +++++++++++++++++ coldstart/system_prompt.txt | 61 ++++++++++++++++++++++++++++++++++++ requirements.txt | 9 ++++++ 7 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 coldstart/.gitignore create mode 100644 coldstart/coldstart.prev create mode 100755 coldstart/coldstart.sh create mode 100644 coldstart/coldstart_agent.py create mode 100644 coldstart/system_prompt.txt create mode 100644 requirements.txt diff --git a/coldstart/.env b/coldstart/.env index cef9088..e69de29 100644 --- a/coldstart/.env +++ b/coldstart/.env @@ -1 +0,0 @@ -GEMINI_API_KEY=AIzaSyA8KDqfeAfpnx9qEK4td3BOxn3R9721fvw diff --git a/coldstart/.gitignore b/coldstart/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/coldstart/.gitignore @@ -0,0 +1 @@ +.env diff --git a/coldstart/coldstart.prev b/coldstart/coldstart.prev new file mode 100644 index 0000000..e69de29 diff --git a/coldstart/coldstart.sh b/coldstart/coldstart.sh new file mode 100755 index 0000000..8b3c45f --- /dev/null +++ b/coldstart/coldstart.sh @@ -0,0 +1,24 @@ +cp coldstart.tmp coldstart.prev 2>/dev/null + +git add .. + +git commit -m "chore/ Running summarizer" +date=$(date +%Y-%m-%d_%H-%M-%S) +filename="agent_summary_${date}.log" +{ + echo "=== GIT LOG ===" + git log --oneline -7 + echo "=== GIT DIFF ===" + git diff HEAD + echo "=== TODO ===" + grep -r TODO ../src/ 2>/dev/null + echo "=== PREVIOUS SESSION SUMMARY ===" + [ -f coldstart.prev ] && cat coldstart.prev +} | python coldstart_agent.py > logs/${filename} + +cat logs/${filename} > coldstart.tmp + + +git add .. + +git commit -m "chore/ Summarizer completion logging" diff --git a/coldstart/coldstart_agent.py b/coldstart/coldstart_agent.py new file mode 100644 index 0000000..bf0a74f --- /dev/null +++ b/coldstart/coldstart_agent.py @@ -0,0 +1,29 @@ +import os +from dotenv import load_dotenv, dotenv_values +from google import genai +from google.genai import types +import sys +load_dotenv() + +client = genai.Client() + +with open("system_prompt.txt", "r") as f: + SYSTEM_PROMPT= f.read() + +history = sys.stdin.read() + + +res = client.models.generate_content( + model="gemini-3-flash-preview", + config=types.GenerateContentConfig( + system_instruction=SYSTEM_PROMPT, + thinking_config=types.ThinkingConfig(thinking_level="medium") + ), + contents=history +) + +reply = res.text + +# NOTE: we are just printing it we will handle inputing in file in bash + +print(reply) diff --git a/coldstart/system_prompt.txt b/coldstart/system_prompt.txt new file mode 100644 index 0000000..4ba15aa --- /dev/null +++ b/coldstart/system_prompt.txt @@ -0,0 +1,61 @@ +You are reconstructing the developer’s mental context after a break. + +You are given a codebase snapshot containing: +- TODO comments +- Inline comments +- Recent changes +You will receive a raw data dump separated by headers (=== GIT LOG ===, === GIT DIFF ===, etc.). Use the previous session summary as your baseline, and use the diff/log to determine what changed +Your job is NOT to summarize code blindly. +Your job is to rebuild what the developer was thinking. + +--- + +## OBJECTIVE + +Extract intent, unfinished work, and next steps so the developer can resume instantly. + +--- + +## OUTPUT FORMAT + +### 1. What I Was Doing +- Current feature or problem being worked on +- Main goal in plain English + +### 2. Active TODOs (Grouped) +- Group TODOs by feature or module +- Convert vague TODOs into clear tasks +- Highlight anything critical vs optional + +### 3. Current State of the Code +- What is already implemented +- What is partially done +- What is missing + +### 4. My Likely Next Steps +- Step-by-step continuation plan +- Order tasks logically (what should be done first) + +### 5. Important Context I Should Not Forget +- Assumptions in the code +- Hacks / temporary fixes +- Constraints (performance, design decisions, etc.) + +### 6. Risks / Tricky Areas +- Parts of the code that may break +- Areas that require careful thinking + +--- + +## RULES + +- Prioritize TODOs and comments over everything else +- Infer intent even if comments are messy or incomplete +- Do NOT restate large chunks of code +- Translate developer shorthand into clear reasoning +- Be practical, not verbose +- If something is unclear, state the uncertainty explicitly + +--- + +You are helping the developer avoid the “what was I even doing?” moment. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d55a677 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +black +ipython +matplotlib +pillow +requests +lxml +mercurial +meson +psutil From b20942f2a052303f741c63899a9a73951ae13b92 Mon Sep 17 00:00:00 2001 From: Aakarsh Kashyap Date: Tue, 31 Mar 2026 01:23:26 +0530 Subject: [PATCH 3/4] Data access error in ReLU function --- coldstart/.env | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 coldstart/.env diff --git a/coldstart/.env b/coldstart/.env deleted file mode 100644 index e69de29..0000000 From e96ef9e1a2735a542a8e7459a3d36ebf72765a45 Mon Sep 17 00:00:00 2001 From: Aakarsh Kashyap Date: Tue, 31 Mar 2026 03:17:59 +0530 Subject: [PATCH 4/4] Some clean up --- 4 | 29 ------------------- check.txt | 2 -- include/soft-cuda/tensor/api.h | 7 +++++ main.cpp | 2 +- .../Experiments}/broadcasting_add.py | 0 {misc => scripts/Experiments/misc}/add.cu | 0 {coldstart => scripts/coldstart}/.gitignore | 0 .../coldstart}/coldstart.prev | 0 {coldstart => scripts/coldstart}/coldstart.sh | 0 .../coldstart}/coldstart_agent.py | 0 .../coldstart}/system_prompt.txt | 0 nsys_easy.sh => scripts/nsys_easy.sh | 0 12 files changed, 8 insertions(+), 32 deletions(-) delete mode 100644 4 delete mode 100644 check.txt rename {Experiments => scripts/Experiments}/broadcasting_add.py (100%) rename {misc => scripts/Experiments/misc}/add.cu (100%) rename {coldstart => scripts/coldstart}/.gitignore (100%) rename {coldstart => scripts/coldstart}/coldstart.prev (100%) rename {coldstart => scripts/coldstart}/coldstart.sh (100%) rename {coldstart => scripts/coldstart}/coldstart_agent.py (100%) rename {coldstart => scripts/coldstart}/system_prompt.txt (100%) rename nsys_easy.sh => scripts/nsys_easy.sh (100%) diff --git a/4 b/4 deleted file mode 100644 index 6d85090..0000000 --- a/4 +++ /dev/null @@ -1,29 +0,0 @@ -#include "internal_header.h" - - -tensor_t *tensor_relu(tensor_pool_t *pool, tensor_t *x) { - assert(pool != NULL); - assert(x != NULL); - - tensor_t *t = tensor_dtype_create(pool, x->dtype, x->ndims, x->dims, NULL); - - t->op = tensor_op_t::RELU; - t->a = x; - t->b = NULL; - return t; -} - -bool tensor_op_relu(tensor_pool_t *pool, tensor_t *t) { - // TODO: Once again remainder to support different dtype cause it's just a prop with only float for now - assert(pool != NULL); - assert(t != NULL); - - float* float_data = ((float*)(t->a->data)); - - for(uint32_t i = 0; i < t->nvalues; i++) { - if (float_data[i] < 0) { - float_data[i] = 0; - } - } - return true; -} diff --git a/check.txt b/check.txt deleted file mode 100644 index c67d295..0000000 --- a/check.txt +++ /dev/null @@ -1,2 +0,0 @@ -To github.com:builders-lab/soft-cuda.git - 512d19a..deb1883 feat/matmul -> feat/matmul diff --git a/include/soft-cuda/tensor/api.h b/include/soft-cuda/tensor/api.h index 31d69d1..befb6e9 100644 --- a/include/soft-cuda/tensor/api.h +++ b/include/soft-cuda/tensor/api.h @@ -141,6 +141,7 @@ size_t tensor_pool_used(tensor_pool_t *pool); // bool tensor_move_device(tensor_t *t, device_type target_device, tensor_pool_t *pool); // NEW IMPLEMENTATION +// DONE bool execution_node_to_host(execution_node_t *node); //////////////////////////////////////////////////////////////////////////////////////////// @@ -217,6 +218,7 @@ tensor_t *tensor_transpose(tensor_pool_t *pool, tensor_t *a); tensor_t *tensor_add(tensor_pool_t *pool, tensor_t *x, tensor_t *y); // Explicit broadcasting for layers (e.g., Y = XW + b) +// DONE tensor_t *tensor_add_bias(tensor_pool_t *pool, const tensor_t *xw, const tensor_t *bias); ///////////////////////////////////////////////////////////// @@ -237,6 +239,7 @@ tensor_t *tensor_add_bias(tensor_pool_t *pool, const tensor_t *xw, const tensor_ // @params out Output tensor // @param a Input tensor +// DONE tensor_t *tensor_relu(tensor_pool_t *pool, tensor_t *a); // Compares result @@ -250,9 +253,13 @@ bool tensor_fill_random_normal(tensor_t *t, float mean, float std_dev); tensor_t *tensor_cross_entropy_loss(tensor_pool_t *pool, const tensor_t *predictions, const tensor_t *targets); +// *********************************************************************************** +// TODO: HAVE TO UPDATED FUNC SIG SPEC // Evalutes the operation(Forward) with depth=1 // @return boolean flag for status +// DONE bool tensor_evaluate( tensor_pool_t *pool,tensor_t *t, float *d_a, float *d_b, float *d_res); +// DONE bool tensor_evaluate_GPU( tensor_pool_t *pool,tensor_t *t, float *d_a, float *d_b, float *d_res); ///////////////////////////////////////////////////////////// diff --git a/main.cpp b/main.cpp index 0f6d94e..84fc8b6 100644 --- a/main.cpp +++ b/main.cpp @@ -55,7 +55,7 @@ int main() { if (oki) { cout << "=========================================== \n"; - cout << "========= TACTICAL VRAM TRACE ============= \n"; + cout << "========= VRAM TRACE ============= \n"; execution_node_t *node = seq.back(); diff --git a/Experiments/broadcasting_add.py b/scripts/Experiments/broadcasting_add.py similarity index 100% rename from Experiments/broadcasting_add.py rename to scripts/Experiments/broadcasting_add.py diff --git a/misc/add.cu b/scripts/Experiments/misc/add.cu similarity index 100% rename from misc/add.cu rename to scripts/Experiments/misc/add.cu diff --git a/coldstart/.gitignore b/scripts/coldstart/.gitignore similarity index 100% rename from coldstart/.gitignore rename to scripts/coldstart/.gitignore diff --git a/coldstart/coldstart.prev b/scripts/coldstart/coldstart.prev similarity index 100% rename from coldstart/coldstart.prev rename to scripts/coldstart/coldstart.prev diff --git a/coldstart/coldstart.sh b/scripts/coldstart/coldstart.sh similarity index 100% rename from coldstart/coldstart.sh rename to scripts/coldstart/coldstart.sh diff --git a/coldstart/coldstart_agent.py b/scripts/coldstart/coldstart_agent.py similarity index 100% rename from coldstart/coldstart_agent.py rename to scripts/coldstart/coldstart_agent.py diff --git a/coldstart/system_prompt.txt b/scripts/coldstart/system_prompt.txt similarity index 100% rename from coldstart/system_prompt.txt rename to scripts/coldstart/system_prompt.txt diff --git a/nsys_easy.sh b/scripts/nsys_easy.sh similarity index 100% rename from nsys_easy.sh rename to scripts/nsys_easy.sh