Skip to content

Commit

Permalink
Add database files for arch and hardware; remove Sparse and DenseMatr…
Browse files Browse the repository at this point in the history
…ix files
  • Loading branch information
EliasReutelsterz committed May 29, 2024
1 parent 8ecfd54 commit 9ed8963
Show file tree
Hide file tree
Showing 49 changed files with 165 additions and 1,797 deletions.
6 changes: 3 additions & 3 deletions benchmarks/double-gemm/generate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from kernelforge import DenseMatrix, GenerationError, GemmGenerator
from kernelforge import GenerationError, GemmGenerator
from kernelforge.common.vm.vm import vm_factory
from kernelforge.common.matrix.tensor import Tensor
import os
import yaml
import argparse
Expand All @@ -22,8 +23,7 @@


def produce_matrix(spec):
return DenseMatrix(num_rows=spec['num_rows'],
num_cols=spec['num_cols'],
return Tensor(shape = [spec['num_rows'], spec['num_cols']],
addressing=spec['addressing'],
bbox=spec['bbox'])

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/fused/internals/frontend/aux.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from kernelforge.common import DenseMatrix, Addressing
from kernelforge.common import Addressing
from kernelforge.common.matrix.tensor import Tensor


class VarFactory:
@classmethod
def produce_matrix(cls, text_descr):
addrs = Addressing.str2addr(text_descr['addressing'])

descr = DenseMatrix(num_rows=text_descr['num_rows'],
num_cols=text_descr['num_cols'],
descr = Tensor(shape=[text_descr['num_rows'], text_descr['num_cols']],
addressing=addrs,
bbox=text_descr['bbox'],
alias=text_descr['name'],
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/fused/internals/frontend/symbol_table.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import enum
from typing import Dict, Union
from kernelforge.common import DenseMatrix, Addressing
from kernelforge.common import Addressing
from kernelforge.common.matrix.tensor import Tensor


class ObjType(enum.Enum):
Expand All @@ -12,7 +13,7 @@ class Attribute:
def __init__(self, descr):
self.descr = descr
self.obj_type = None
if isinstance(descr, DenseMatrix):
if isinstance(descr, Tensor):
self.obj_type = ObjType.MATRIX
elif isinstance(descr, float):
self.obj_type = ObjType.SCALAR
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/gemm-chain/generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from kernelforge import DenseMatrix, GenerationError, GemmGenerator
from kernelforge import GenerationError, GemmGenerator
from kernelforge.common.matrix.tensor import Tensor
from kernelforge.common.vm.vm import vm_factory
from jinja2 import Environment, FileSystemLoader
import os
Expand All @@ -25,8 +26,7 @@


def produce_matrix(spec):
return DenseMatrix(num_rows=spec['num_rows'],
num_cols=spec['num_cols'],
return Tensor(shape = [spec['num_rows'], spec['num_cols']],
addressing=spec['addressing'],
bbox=spec['bbox'])

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/simple-gemm/generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from kernelforge import DenseMatrix, GenerationError
from kernelforge import GenerationError
from kernelforge.common.matrix.tensor import Tensor
from kernelforge import GemmGenerator, GemmKernelType
from kernelforge.common.vm.vm import vm_factory
import os
Expand All @@ -22,8 +23,7 @@
args = parser.parse_args()

def produce_matrix(spec):
return DenseMatrix(num_rows=spec['num_rows'],
num_cols=spec['num_cols'],
return Tensor(shape = [spec['num_rows'], spec['num_cols']],
addressing=spec['addressing'],
bbox=spec['bbox'])

Expand Down
2 changes: 1 addition & 1 deletion example/abb_trans.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from kernelforge.common import DenseMatrix
from kernelforge.common.matrix.tensor import Tensor
from kernelforge.common.context import Context
from kernelforge.common.aux import generate_tmp_matrix
from kernelforge.generators.descriptions import GemmDescr, FloatingPointType, Addressing
Expand Down
9 changes: 4 additions & 5 deletions example/csa.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from kernelforge import DenseMatrix, GenerationError, CsaGenerator
from kernelforge import GenerationError, CsaGenerator
from kernelforge.common.matrix.tensor import Tensor
from kernelforge.common.vm.vm import vm_factory
import argparse
from kernelforge.backend.instructions.csa import CSA
Expand All @@ -18,13 +19,11 @@

args = parser.parse_args()

mat_a = DenseMatrix(num_rows=9,
num_cols=9,
mat_a = Tensor(shape=[9, 9],
addressing='strided',
bbox=[0, 0, 9, 9])

mat_b = DenseMatrix(num_rows=9,
num_cols=9,
mat_b = Tensor(shape=[9, 9],
addressing='strided',
bbox=[0, 0, 9, 9])

Expand Down
1 change: 0 additions & 1 deletion example/four_matrices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from kernelforge.common.matrix.dense import DenseMatrix
from kernelforge.common.matrix.boundingbox import BoundingBox
from kernelforge.common.matrix.tensor import Tensor
from kernelforge.common.context import Context
Expand Down
1 change: 0 additions & 1 deletion example/gemm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from kernelforge.common.matrix.dense import DenseMatrix
from kernelforge.common.context import Context
from kernelforge.generators.descriptions import GemmDescr
from kernelforge.common.basic_types import FloatingPointType, Addressing
Expand Down
1 change: 0 additions & 1 deletion example/trace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from kernelforge.common.matrix.dense import DenseMatrix
from kernelforge.common.matrix.boundingbox import BoundingBox
from kernelforge.common.matrix.tensor import Tensor
from kernelforge.common.context import Context
Expand Down
2 changes: 1 addition & 1 deletion examples/hosvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def add(g):

Alist = [A[i][alph[13+i] + alph[i]] for i in range(N)]
hosvd = G[alph[0:N]] <= X[alph[13:13+N]] * reduce(lambda x, y: x * y, Alist)
g.add('hosvd', hosvd)
g.add('hosvd', hosvd, target = "gpu")
2 changes: 1 addition & 1 deletion examples/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def add(g):
C = Tensor('C', (N, N))

kernel = C['ij'] <= 2.0 * C['ij'] + A['lj'] * B['ikl'] * w['k']
g.add('kernel', kernel)
g.add('kernel', kernel, target = "gpu")
2 changes: 1 addition & 1 deletion examples/optimal_ind.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def add(g):
kernel = [ tmp1[i1] <= B['befl'] * D['cdel'],
tmp2[i2] <= tmp1[i1] * C['dfjk'],
S['abij'] <= tmp2[i2] * A['acik'] ]
g.add('kernel_{}_{}'.format(i1,i2), kernel)
g.add('kernel_{}_{}'.format(i1,i2), kernel, target = "gpu")



4 changes: 2 additions & 2 deletions examples/seissol_eqspp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def add(g):

Q = Tensor('Q', (8, 20, 15))
I = Tensor('I', (8, 20, 15))
g.add('seissol_stiffness', Q['skp'] <= db.kXiTDivM['lk'] * I['slq'] * db.star['qp'])
g.add('seissol_stiffness', Q['skp'] <= db.kXiTDivM['lk'] * I['slq'] * db.star['qp'], target = "gpu")

# Reproduces recursive generation of zero blocks in Cauchy-Kowalevski prodedure,
# described in "Sustained Petascale Performance of Seismic Simulations with SeisSol on SuperMUC",
Expand All @@ -29,5 +29,5 @@ def add(g):
derivativeSum = DeduceIndices('kp').visit(derivativeSum)
derivativeSum = EquivalentSparsityPattern().visit(derivativeSum)
dQ = Tensor('dQ({})'.format(i), dQ_shape, spp=derivativeSum.eqspp())
g.add('derivative({})'.format(i), dQ['kp'] <= derivativeSum)
g.add('derivative({})'.format(i), dQ['kp'] <= derivativeSum, target = "gpu")
dQ_prev = dQ
2 changes: 1 addition & 1 deletion examples/springer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def add_bench(g, descr, sizes):
B = add_tensor('B', Bind, size)
C = add_tensor('C', Cind, size)

g.add(descr.replace('-','_'), C[Cind] <= A[Aind] * B[Bind])
g.add(descr.replace('-','_'), C[Cind] <= A[Aind] * B[Bind], target = "gpu")
_bench_no = _bench_no + 1

def add(g):
Expand Down
6 changes: 3 additions & 3 deletions examples/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def add(g):
ZR = Tensor('ZR' + pqx, (q,p))

stock = R['ijk'] <= S['xyz'] * XL['xl'] * XR['li'] * YL['ym'] * YR['mj'] * ZL['zn'] * ZR['nk']
g.add('stock' + pqx, stock)
g.add('stock' + pqx, stock, target = "gpu")

stock = R['ijk'] <= S['xyz'] * XLT['lx'] * XRT['il'] * YL['ym'] * YR['mj'] * ZL['zn'] * ZR['nk']
g.add('stock{}_trans'.format(pqx), stock)
g.add('stock{}_trans'.format(pqx), stock, target = "gpu")

stock = R['ijk'] <= S['xyz'] * XLTP['lx'] * XRTP['il'] * YL['ym'] * YR['mj'] * ZL['zn'] * ZR['nk']
g.add('stock{}_trans_pad'.format(pqx), stock)
g.add('stock{}_trans_pad'.format(pqx), stock, target = "gpu")

6 changes: 3 additions & 3 deletions examples/tce.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def add(g):
B2 = Tensor('T', (V, V, V, V))

kernel = S['abij'] <= A['acik'] * B['befl'] * C['dfjk'] * D['cdel']
g.add('tce1', kernel)
g.add('tce1', kernel, target = "gpu")

kernel = B2['abcd'] <= C1['sd'] * C2['rc'] * C3['qb'] * C4['pa'] * A2['pqrs']
g.add('tce2', kernel)
g.add('tce2', kernel, target = "gpu")

kernel = B2['abcd'] <= C1['sd'] * C2['rc'] * C3['qb'] * C4T['ap'] * A2['pqrs']
g.add('tce2_trans', kernel)
g.add('tce2_trans', kernel, target = "gpu")

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9ed8963

Please sign in to comment.