Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSE 586 Final Code Additions #1485

Draft
wants to merge 99 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
0e1db7e
init push with some testing
therkels Nov 4, 2024
4a73e8e
threading example
therkels Nov 4, 2024
0deb391
initial gins stuff
therkels Nov 5, 2024
db2503e
g
clin155 Nov 5, 2024
0035e37
g
clin155 Nov 5, 2024
2bdcf34
family friendly test statement
therkels Nov 5, 2024
d35e18e
remove cached files
therkels Nov 7, 2024
56cb036
Cleanup ShellGhost
Jayanaka-98 Nov 8, 2024
eeffd6f
hot path test code
therkels Nov 8, 2024
0c6fdba
starting pass
Jayanaka-98 Nov 9, 2024
a0c9811
Bytecode extraction
Jayanaka-98 Nov 9, 2024
aa9bf7e
claude went to work?
Nov 9, 2024
eaef225
gitignore
Nov 9, 2024
7268ee9
updated examples
therkels Nov 9, 2024
7771a43
adding cfg stuff based on article
therkels Nov 9, 2024
6ddea85
vizualizing hot_path.jac
therkels Nov 10, 2024
f17ed65
remove code
therkels Nov 15, 2024
cd217b1
CFG pass
Jayanaka-98 Nov 15, 2024
56d2730
Merge branch 'main' of https://github.com/therkels/jaseci-ginS into mlir
Jayanaka-98 Nov 15, 2024
32f59a4
access CFG from ShellGhost
Jayanaka-98 Nov 15, 2024
efe9817
Merge pull request #2 from therkels/mlir
Jayanaka-98 Nov 15, 2024
8ca61c9
delete outdated cfg
Jayanaka-98 Nov 15, 2024
b7a7e23
if not gin flag
Jayanaka-98 Nov 15, 2024
0f50b85
tracing in exec
therkels Nov 15, 2024
617f6da
Fixup code for validating offsets, and making gins code apply only wi…
Jayanaka-98 Nov 16, 2024
fa41b84
fix jump_forward?
therkels Nov 16, 2024
b18597e
clean up test code
therkels Nov 16, 2024
35b294f
adding AI
therkels Nov 18, 2024
fe4b525
include information on BB instructions
therkels Nov 18, 2024
abcbefc
include instructions list
therkels Nov 18, 2024
530f632
fix cfg creation
therkels Nov 18, 2024
b99df75
bug fix: check last BB for offset diff
therkels Nov 18, 2024
af4ac61
bug fix: stop last BB from self referencing on edge
therkels Nov 18, 2024
0d602f3
comment out for testing
therkels Nov 20, 2024
cbd105f
Merge pull request #3 from therkels/feat/add_llm_prompting
therkels Nov 20, 2024
3f072e8
Merge branch 'Jaseci-Labs:main' into main
therkels Nov 20, 2024
c3b74df
show changes without AI prompt
therkels Nov 20, 2024
ee87a76
Add variable tracking
clin155 Nov 21, 2024
e3307fc
Added cfg support for loops
clin155 Nov 21, 2024
f8baa22
add live variable tracking
clin155 Nov 21, 2024
8ce63eb
v
clin155 Nov 21, 2024
7aad35c
fixed the line number variable for python 3.13 and added to LLM prompt
jmgrode Nov 22, 2024
294da36
clean up cfg file
therkels Nov 22, 2024
807f114
small changes updating line nos to actually map to line numbers of pr…
jmgrode Nov 22, 2024
9d72e84
fix jump forward not connecting in BB
therkels Nov 22, 2024
909b72a
moved to 3.13
clin155 Nov 22, 2024
7822e24
g
clin155 Nov 22, 2024
bf7d84b
remove out
clin155 Nov 22, 2024
c3f59ff
added offsets to BBs
clin155 Nov 22, 2024
eb4ca17
Dynamic Profiling on offsets
clin155 Nov 22, 2024
526f8b9
fix for exceptions
clin155 Nov 22, 2024
1356c20
Add gemini prompting and variable values
clin155 Nov 24, 2024
e610a19
your commit message
Jayanaka-98 Nov 25, 2024
4e8ac6d
modular ghost
Jayanaka-98 Nov 25, 2024
73e779a
Merge pull request #4 from therkels/temp
Jayanaka-98 Nov 25, 2024
f4f2594
visualization code uncomment
Jayanaka-98 Nov 25, 2024
f7e975b
new jac example for threading
Jayanaka-98 Nov 25, 2024
eb630bb
consistent file naming for examples
therkels Nov 26, 2024
7ee2d4b
Merge branch 'main' into variables
therkels Nov 26, 2024
b1e7350
clean up bb logic
therkels Nov 26, 2024
f582d1f
simplify and fix cfg logic
therkels Nov 26, 2024
b66a3f4
simplify cfg and bb logic
therkels Nov 26, 2024
a8e4133
update prompt
Jayanaka-98 Nov 26, 2024
b700b05
Merge pull request #5 from therkels/variables
therkels Nov 26, 2024
25ae370
Merge branch 'Jaseci-Labs:main' into main
therkels Nov 26, 2024
388f7b4
deque and history of cfg updates
therkels Nov 27, 2024
412d6bb
black formatting
Jayanaka-98 Nov 28, 2024
0c73331
deque braught into tracer
Jayanaka-98 Nov 28, 2024
1109109
made model modular and non breaking for import errors.
Jayanaka-98 Nov 28, 2024
8308390
Merge branch 'Jaseci-Labs:main' into cfg_history
Jayanaka-98 Nov 28, 2024
d6d99e2
Merge branch 'Jaseci-Labs:main' into main
Jayanaka-98 Nov 28, 2024
72594aa
long running power program with gradual devide by zero
Jayanaka-98 Dec 1, 2024
4713793
adding phase switch program
jmgrode Dec 1, 2024
01de803
static code analysis for comparison
therkels Dec 1, 2024
ea4b5c6
result example
therkels Dec 1, 2024
220cc69
use history stuff as results example
therkels Dec 2, 2024
906a5ec
module based CFG history
therkels Dec 3, 2024
90fff4a
remove prints
therkels Dec 3, 2024
c7c2ef0
final changes
therkels Dec 3, 2024
69d9e24
Merge pull request #6 from therkels/cfg_history
therkels Dec 3, 2024
8e4dd24
Merge branch 'Jaseci-Labs:main' into main
therkels Dec 3, 2024
e02ddd3
test json output
therkels Dec 3, 2024
d1772ee
more clear id name
therkels Dec 3, 2024
e497598
some bike shedding w/ settrace
hejohns Dec 4, 2024
59a135c
really stupid and hacked way to "pass" program input to gins
hejohns Dec 4, 2024
4ca1825
Merge pull request #7 from hejohns/a-way-over-complicated-way-to-mock…
therkels Dec 4, 2024
a716b95
off by 1
hejohns Dec 4, 2024
6cb108f
this and the last commit should fix the TODOs in 59a135c
hejohns Dec 4, 2024
9a1a0c5
example with input
therkels Dec 4, 2024
56387f3
example of modules not working :/
therkels Dec 4, 2024
a43118f
inlining inputs
therkels Dec 4, 2024
ecc2e8d
Merge branch 'main' into feat/json_cfgs
therkels Dec 4, 2024
0710ce0
random, but stable json output from llm
therkels Dec 5, 2024
d4d2d28
seperate structured output
therkels Dec 5, 2024
e8714e1
hot_path updates and input generation
therkels Dec 5, 2024
590f4ac
small updates
therkels Dec 5, 2024
a640f0f
Merge pull request #9 from therkels/feat/json_cfgs
therkels Dec 5, 2024
8b4b15e
getting basic inputs (hacky method)
therkels Dec 5, 2024
b8e4724
adding tests with variable hot path iterations and variable iterations
jmgrode Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
.jac_mypy_cache/
.envrc

#ignore generated visual files
cfg.gv.pdf
cfg.gv
9 changes: 9 additions & 0 deletions cfg.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Control Flow Graph
digraph {
bb0 [label=BB0]
bb1 [label=BB1]
bb2 [label=BB2]
bb0 -> bb2
bb0 -> bb1
bb1 -> bb2
}
Binary file added cfg.gv.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions jac/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ out.txt

# Jaclang session files
*.session

env/*
21 changes: 21 additions & 0 deletions jac/cfg.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Control Flow Graph
digraph {
bb0 [label=BB0]
bb1 [label=BB1]
bb2 [label=BB2]
bb3 [label=BB3]
bb4 [label=BB4]
bb5 [label=BB5]
bb6 [label=BB6]
bb7 [label=BB7]
bb0 -> bb7
bb0 -> bb1
bb1 -> bb3
bb1 -> bb2
bb2 -> bb4
bb3 -> bb4
bb4 -> bb6
bb4 -> bb5
bb5 -> bb1
bb6 -> bb7
}
Binary file added jac/cfg.gv.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions jac/error
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ERROR - division by zero
ERROR - Error: division by zero
13 | # i += 1;
14 | }
15 | print(y/0);
| ^^^
16 | print(y);
17 | print("hello");
at <module> /Users/christopherlin/Desktop/Classes/jaseci-ginS/jac/example.jac:15
division by zero
23 changes: 23 additions & 0 deletions jac/examples/gins_scripts/acc_itr.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num + (num + 1));
}
for i in range(len(series)) {
while itr < (series[i] * 100000) {
if (itr/2 < threshold) {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
24 changes: 24 additions & 0 deletions jac/examples/gins_scripts/accu_hot_path.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num + (num + 1));
}
for i in range(len(series)) {
while itr < 100000 {
accu += series[i];
if (accu < threshold) {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
28 changes: 28 additions & 0 deletions jac/examples/gins_scripts/cfg.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Control Flow Graph
digraph {
bb0 [label=BB0]
bb1 [label=BB1]
bb2 [label=BB2]
bb3 [label=BB3]
bb4 [label=BB4]
bb5 [label=BB5]
bb6 [label=BB6]
bb7 [label=BB7]
bb8 [label=BB8]
bb9 [label=BB9]
bb10 [label=BB10]
bb0 -> bb2
bb0 -> bb1
bb1 -> bb3
bb2 -> bb3
bb3 -> bb10
bb3 -> bb4
bb4 -> bb6
bb4 -> bb5
bb5 -> bb7
bb6 -> bb7
bb7 -> bb9
bb7 -> bb8
bb8 -> bb4
bb9 -> bb10
}
Binary file added jac/examples/gins_scripts/cfg.gv.pdf
Binary file not shown.
35 changes: 35 additions & 0 deletions jac/examples/gins_scripts/example.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# with entry {
# x:int = 0;
# y:int = 3;
# z:int = x + y;
# i:int = 0;

# while (i < 3) {
# # if i % 2 {
# # print("d");
# # }
# x = 4;
# y = y + x;
# i += 1;
# }
# print(y/0);
# print(y);
# print("hello");
# }
with entry {
x:int = 0;
y:int = 3;
z:int = x + y;
for i in range(49) {
x = 4 * i + y * (z);
if x % 2 {
y= 0;
}
else {
y = 4;
}
}
z = x/y;
print(y);
print("hello");
}
24 changes: 24 additions & 0 deletions jac/examples/gins_scripts/exp_hot_path.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num);
}
for i in range(len(series)){
while itr < 100000 {
accu += series[i];
if accu < threshold {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
24 changes: 24 additions & 0 deletions jac/examples/gins_scripts/exp_hot_path2.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num * num);
}
for i in range(len(series)) {
while itr < 100000 {
accu += series[i];
if accu < threshold {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
24 changes: 24 additions & 0 deletions jac/examples/gins_scripts/exp_hot_path3.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num + num);
}
for i in range(len(series)) {
while itr < 100000 {
accu += series[i];
if accu < threshold {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
23 changes: 23 additions & 0 deletions jac/examples/gins_scripts/exp_itr.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num);
}
for i in range(len(series)){
while itr < (series[i] * 100000) {
if (itr/2 < threshold) {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
23 changes: 23 additions & 0 deletions jac/examples/gins_scripts/exp_itr2.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num * num);
}
for i in range(len(series)){
while itr < (series[i] * 100000) {
if (itr/2 < threshold) {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
23 changes: 23 additions & 0 deletions jac/examples/gins_scripts/exp_itr3.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import:py random;

with entry {
accu:int = 0;
itr:int = 0;
threshold:int = 500000;
series:list=[];
meas:list=[0,0,0,0,0,0,0,0,0,0];
for num in range(10) {
series.append(num * num + num);
}
for i in range(len(series)){
while itr < (series[i] * 100000) {
if (itr/2 < threshold) {
meas[i] += random.uniform(0.01,0.05);
}
else {
meas[i] -= random.uniform(0.01,0.05);
}
itr += 1;
}
}
}
43 changes: 43 additions & 0 deletions jac/examples/gins_scripts/hot_path.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import:py os;
import:py random;

with entry {
current_directory = os.path.dirname(os.path.abspath(__file__));
input_dir = os.path.join(current_directory,'inputs/test.txt');

var = [];
with open(input_dir, 'r') as file {
for line in file {
# Process each line here
var.append(float(line.strip())); # .strip() removes trailing newlines
}
}
a:int = 0;
b:int = 0;
c:int = 0;
input_val:float = 0.0;
test_val: float = 0.0;
count:int = 0;
accum_sum:float = 0.0;
changing_average:float = 0;
change_reduction_arr:list=[];
for val in var {
input_val = val;
count = count + 1;
accum_sum = accum_sum + val;
changing_average = accum_sum/count;
if (changing_average)/100 < 1.0 {
test_val:int = test_val + 100.0;
}
else {
for i in range(count) {
test_val = test_val + 10.0;
}
}
}
while test_val > 0 {
reduce:float = random.uniform(5.0,10.0);
test_val -= 100.0;
# change_reduction_arr.append(test_val);
}
}
Binary file added jac/examples/gins_scripts/hot_path_cfg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions jac/examples/gins_scripts/import_helper.jac
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import:py os;
can import_inputs() {
current_directory = os.path.dirname(os.path.abspath(__file__));
input_dir = os.path.join(current_directory,'inputs/test.txt');
var = [];
with open(input_dir, 'r') as file {
for line in file {
# Process each line here
var.append(int(line.strip())); # .strip() removes trailing newlines
}
}
return var;
}
10 changes: 10 additions & 0 deletions jac/examples/gins_scripts/import_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
def import_inputs():
current_directory = os.path.dirname(os.path.abspath(__file__))
input_dir = os.path.join(current_directory,'inputs/test.txt')
inputs = []
with open(input_dir, 'r') as file:
for line in file:
# Process each line here
inputs.append[int(line.strip())] # .strip() removes trailing newlines
return inputs
Loading