MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / pointwise_inputs

Function pointwise_inputs

src/fuse_attention.cpp:45–64  ·  view source on GitHub ↗

TODO: Write this in matcher.hpp as a general matcher for iterating through inputs

Source from the content-addressed store, hash-verified

43
44// TODO: Write this in matcher.hpp as a general matcher for iterating through inputs
45inline auto pointwise_inputs()
46{
47 return [](auto start, auto f) {
48 std::unordered_set<instruction_ref> visited;
49 fix([&](auto self, auto ins) {
50 if(ins->can_eval())
51 return;
52 if(not visited.insert(ins).second)
53 return;
54 if(not ins->get_operator().attributes().contains("pointwise") and
55 ins->get_operator().name() != "reshape")
56 {
57 f(ins);
58 return;
59 }
60 for(auto input : ins->inputs())
61 self(input);
62 })(start);
63 };
64}
65
66struct find_attention
67{

Callers 1

matcherMethod · 0.85

Calls 7

fixFunction · 0.85
can_evalMethod · 0.80
insertMethod · 0.45
containsMethod · 0.45
attributesMethod · 0.45
nameMethod · 0.45
inputsMethod · 0.45

Tested by

no test coverage detected