-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(example): Add a python example to codegen whole gemm. #20
Conversation
@@ -0,0 +1,163 @@ | |||
''' | |||
Whole GEMM is an example of GEMM that utilized all mempry hierarchies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a typo here. "that utilizes all memory hierarchies"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
|
||
GemmNode = pythriller.PyNode.gemm(NodeA, NodeB, NodeAcc) | ||
GemmNode = Node.gemm(NodeA, NodeB, NodeAcc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have some questions due to my curiosity.
-
Does
Tensor(data)
also represent a node in the graph, functioning similarly to a "buffer"? -
Intuitively,
gemm
is an operation with input and output. How does it differentiate between the input and output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- A
Tensor
is essentially aBuffer
, which I haverenamed
:
#[pyclass(unsendable, module = "buffer", name = "Tensor")]
pub struct PyBuffer(pub Rc<Buffer>);
gemm
takes three parameters:a
andb
as inputs, andc
as the output:
#[staticmethod]
fn gemm(a: PyRef<PyNode>, b: PyRef<PyNode>, c: PyRef<PyNode>) -> Self {
let access_map = AccessMap::new(0, vec![]);
let node_a = Rc::clone(&a.0);
let node_b = Rc::clone(&b.0);
let node_c = Rc::clone(&c.0);
let gemm = Gemm::new(vec![node_a, node_b], node_c, Rc::new(access_map));
let node = ThrillerNode::new(ThrillerNodeInner::Op(Box::new(gemm)));
PyNode(Rc::new(RefCell::new(node)))
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you.
EdgeB_GEMM = pythriller.PyEdge(NodeB, GemmNode) | ||
EdgeGemm_Acc = pythriller.PyEdge(GemmNode, NodeAcc) | ||
EdgeA_Gemm = Edge(NodeA, GemmNode) | ||
EdgeB_GEMM = Edge(NodeB, GemmNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EdgeA_gemm
and EdgeB_GEMM
have different naming style, is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
resolved #16.