Skip to content

Commit 770667d

Browse files
authored
aispace&py&action (#94)
* py: 1.deepxutil safetensor模型转换完成 * scheduler: 1.aispace 分布式程序自动调度器,POC阶段 * action: 1.fix * aispace: POC验证
1 parent dd7736c commit 770667d

16 files changed

Lines changed: 209 additions & 4 deletions

File tree

.github/workflows/excuter-ompsimd-linux.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Excuter/ompsimd-linux Build
2-
on: [push, pull_request]
32
on: [push, pull_request]
43
push:
54
paths:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 一.deepx概述
44
deepx一种以IR计算图为核心的原生分布式自动并行的训推一体化的深度学习框架,以IR计算图为核心,经过多层级等价替换,实现从简单的数学形式的计算图,自适应等价替换为分布式、并行、自动反向的工程系统架构。
55

6-
deepx的分前中后端,分别是为前端表达侧,编译替换层,执行器层,遵守严格的进程间与代码组件的隔离,以保证分工明确,架构长久稳定。
6+
deepx的分前中后端,分别是为前端表达侧,编译替换调度层,执行器层,遵守严格的进程间与代码组件的隔离,以保证分工明确,架构长久稳定。
77

88
+ 前端/模型表达侧,交由算法工程师、用接近数学的表达方式,设计其数学计算过程。只表示为单线程的简洁数学表达过程,不涉及复杂的device类型、分布式等。
99
+ 中端:编译替换与分布式调度层:注册了多轮不同类型的IR编译器,实现等价替换,可以以插件的形式增加自定义能力如定制kvcache,实现对计算图进行局部替换,获得新的能力。

front/py/deepx/nn/deepxir.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,39 @@ def __str__(self) -> str:
215215
parts.append(f"start_at={self._start_at.strftime('%H:%M:%S.%f')[:-3]}")
216216
if self._finish_at is not None:
217217
parts.append(f"finish_at={self._finish_at.strftime('%H:%M:%S.%f')[:-3]}")
218-
return ' '.join(parts)
218+
return ' '.join(parts)
219+
220+
def ref_funcstart(fname:str,args_:list, returns_:list):
221+
args=[]
222+
for arg in args_:
223+
if isinstance(arg,Tensor):
224+
args.append(Param.tensor(arg))
225+
elif isinstance(arg,int) or isinstance(arg,float):
226+
args.append(Param.varnum(arg))
227+
elif isinstance(arg,bool):
228+
args.append(Param.varbool(arg))
229+
elif isinstance(arg,str):
230+
args.append(Param.varstr(arg))
231+
else:
232+
raise TypeError(f"Unsupported argument type: {type(arg)}")
233+
returns=[]
234+
for ret in returns_:
235+
if isinstance(ret,Tensor):
236+
returns.append(Param.tensor(ret))
237+
elif isinstance(arg,int) or isinstance(arg,float):
238+
returns.append(Param.varnum(ret))
239+
elif isinstance(ret,bool):
240+
returns.append(Param.varbool(ret))
241+
elif isinstance(ret,str):
242+
returns.append(Param.varstr(ret))
243+
else:
244+
raise TypeError(f"Unsupported return type: {type(ret)}")
245+
ir=DeepxIR(fname, args, returns,'')
246+
#send(ir)
247+
248+
def FuseFunc(f):
249+
fname=f.__name__
250+
251+
f()
252+
253+
return

front/py/deepxutil/numpy/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def save_numpy(t,tensorpath:str,realdtype:str=None):
1212
shape=Shape(t.shape)
1313
shape._dtype=str(t.dtype)
1414
if realdtype is not None:
15-
shape._realdtype=realdtype
15+
shape._dtype=realdtype
1616
shape.save(tensorpath+".shape")
1717

1818
array = ascontiguousarray(t)

scheduler/aispace/cell.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package aispace
2+
3+
type CellValue any
4+
type Cell struct {
5+
// Key 唯一标识符
6+
Key string `json:"key"`
7+
// Value 存储的值,可以是任意类型
8+
Value CellValue `json:"value"`
9+
// Type 类型标识符,便于区分不同类型的 Cell
10+
}

scheduler/aispace/funcs/func.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package funcs
2+
3+
import "aispace"
4+
5+
type Func struct {
6+
// Name 函数名称
7+
Name string `json:"name"`
8+
Args []aispace.CellValue `json:"args"` // 函数参数列表
9+
Returns []aispace.CellValue `json:"returns"` // 函数返回值列表
10+
}
11+
12+
type FuncSpace struct {
13+
// Name 函数名称
14+
root Func
15+
Pointer *FuncSpace // 指向父函数空间
16+
}

scheduler/aispace/funcs/tensor.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package funcs
2+
3+
type TensorShape struct {
4+
dims []int // 形状的维度
5+
strides []int // 步长
6+
}
7+
type TensorData struct {
8+
LocatypeType string // 数据类型
9+
LocatypeUrl int // 数据类型大小
10+
}
11+
12+
type Tensor struct {
13+
Var
14+
Shape TensorShape // 张量的形状
15+
16+
}

scheduler/aispace/funcs/var.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package funcs
2+
3+
type Var struct {
4+
funcspace *FuncSpace // 函数空间
5+
Name string // 变量名称
6+
}
7+
8+
type Bool struct {
9+
Var
10+
Value bool
11+
}
12+
13+
type Byte struct {
14+
Var
15+
Value byte
16+
}
17+
18+
type Int8 struct {
19+
Var
20+
Value int8
21+
}
22+
23+
type Int16 struct {
24+
Var
25+
Value int16
26+
}
27+
28+
type IntPair struct {
29+
Var
30+
Value [2]int
31+
}

scheduler/aispace/funcs/vector.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package funcs
2+
3+
type Bytes struct {
4+
Var
5+
Value []byte
6+
}
7+
8+
type String struct {
9+
Var
10+
Value []byte
11+
}

scheduler/aispace/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module aispace
2+
3+
go 1.20

0 commit comments

Comments
 (0)