"...composable_kernel_rocm.git" did not exist on "7b8e2cf68235bba17975324a22235b963382e15e"
Commit 3a3fbc84 authored by Paul's avatar Paul
Browse files

Add output_alias functions

parent 52d9e7ee
...@@ -296,6 +296,10 @@ struct transpose ...@@ -296,6 +296,10 @@ struct transpose
{ {
return {std::move(output_shape), std::move(args.front().data)}; return {std::move(output_shape), std::move(args.front().data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct contiguous struct contiguous
...@@ -359,6 +363,10 @@ struct concat ...@@ -359,6 +363,10 @@ struct concat
new_lens[axis] = new_dim_axis; new_lens[axis] = new_dim_axis;
return {type, new_lens}; return {type, new_lens};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct slice struct slice
...@@ -440,6 +448,10 @@ struct slice ...@@ -440,6 +448,10 @@ struct slice
auto offset = compute_offset(input.get_shape()) * output_shape.type_size(); auto offset = compute_offset(input.get_shape()) * output_shape.type_size();
return {std::move(output_shape), [=] { return input.data() + offset; }}; return {std::move(output_shape), [=] { return input.data() + offset; }};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct squeeze struct squeeze
...@@ -487,6 +499,10 @@ struct squeeze ...@@ -487,6 +499,10 @@ struct squeeze
{ {
return {std::move(output_shape), std::move(args.front().data)}; return {std::move(output_shape), std::move(args.front().data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct unsqueeze struct unsqueeze
...@@ -525,6 +541,10 @@ struct unsqueeze ...@@ -525,6 +541,10 @@ struct unsqueeze
{ {
return {std::move(output_shape), std::move(args.front().data)}; return {std::move(output_shape), std::move(args.front().data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct reshape struct reshape
...@@ -576,6 +596,10 @@ struct reshape ...@@ -576,6 +596,10 @@ struct reshape
{ {
return {std::move(output_shape), std::move(args.front().data)}; return {std::move(output_shape), std::move(args.front().data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct dot struct dot
...@@ -713,6 +737,10 @@ struct flatten ...@@ -713,6 +737,10 @@ struct flatten
{ {
return {std::move(output_shape), std::move(args.front().data)}; return {std::move(output_shape), std::move(args.front().data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct broadcast struct broadcast
{ {
...@@ -755,6 +783,10 @@ struct broadcast ...@@ -755,6 +783,10 @@ struct broadcast
{ {
return {std::move(output_shape), std::move(args.at(0).data)}; return {std::move(output_shape), std::move(args.at(0).data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct scalar struct scalar
...@@ -776,6 +808,10 @@ struct scalar ...@@ -776,6 +808,10 @@ struct scalar
{ {
return {std::move(output_shape), std::move(args.at(0).data)}; return {std::move(output_shape), std::move(args.at(0).data)};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct binary struct binary
...@@ -828,6 +864,10 @@ struct load ...@@ -828,6 +864,10 @@ struct load
{ {
return {s, args[0].data() + offset}; return {s, args[0].data() + offset};
} }
int output_alias(const std::vector<shape>&) const
{
return 0;
}
}; };
struct outline struct outline
......
...@@ -280,7 +280,7 @@ void program::compile(const target& t, tracer trace) ...@@ -280,7 +280,7 @@ void program::compile(const target& t, tracer trace)
{ {
assert(this->validate() == impl->instructions.end()); assert(this->validate() == impl->instructions.end());
this->impl->ctx = t.get_context(); this->impl->ctx = t.get_context();
if(not trace.enabled() and enabled(MIGRAPH_TRACE_COMPILE{})) if(not trace.enabled() or enabled(MIGRAPH_TRACE_COMPILE{}))
trace = tracer{std::cout}; trace = tracer{std::cout};
trace(*this); trace(*this);
trace(); trace();
......
...@@ -25,6 +25,7 @@ struct hip_add ...@@ -25,6 +25,7 @@ struct hip_add
std::string name() const { return "gpu::add"; } std::string name() const { return "gpu::add"; }
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument compute(context&, const shape&, const std::vector<argument>& args) const; argument compute(context&, const shape&, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
struct miopen_add struct miopen_add
...@@ -33,6 +34,7 @@ struct miopen_add ...@@ -33,6 +34,7 @@ struct miopen_add
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -27,6 +27,7 @@ struct miopen_batch_norm_inference ...@@ -27,6 +27,7 @@ struct miopen_batch_norm_inference
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -28,6 +28,7 @@ struct hip_concat ...@@ -28,6 +28,7 @@ struct hip_concat
shape compute_shape(std::vector<shape> inputs) const; shape compute_shape(std::vector<shape> inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -26,6 +26,7 @@ struct miopen_contiguous ...@@ -26,6 +26,7 @@ struct miopen_contiguous
std::string name() const { return "gpu::contiguous"; } std::string name() const { return "gpu::contiguous"; }
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument compute(context&, shape output_shape, const std::vector<argument>& args) const; argument compute(context&, shape output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -38,6 +38,7 @@ struct miopen_convolution ...@@ -38,6 +38,7 @@ struct miopen_convolution
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
shape compile(context& ctx, const shape& output_shape, std::vector<instruction_ref> inputs); shape compile(context& ctx, const shape& output_shape, std::vector<instruction_ref> inputs);
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -27,6 +27,7 @@ struct miopen_gemm ...@@ -27,6 +27,7 @@ struct miopen_gemm
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -67,6 +67,7 @@ struct hip_write ...@@ -67,6 +67,7 @@ struct hip_write
{ {
return to_gpu(args.front()); return to_gpu(args.front());
} }
int output_alias(const std::vector<shape>&) const { return 0; }
}; };
struct hip_copy struct hip_copy
...@@ -82,6 +83,7 @@ struct hip_copy ...@@ -82,6 +83,7 @@ struct hip_copy
copy_to_gpu(args[0], args[1]); copy_to_gpu(args[0], args[1]);
return args[1]; return args[1];
} }
int output_alias(const std::vector<shape>&) const { return 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace migraph } // namespace migraph
......
...@@ -27,6 +27,7 @@ struct miopen_leaky_relu ...@@ -27,6 +27,7 @@ struct miopen_leaky_relu
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -25,6 +25,7 @@ struct hip_mul ...@@ -25,6 +25,7 @@ struct hip_mul
std::string name() const { return "gpu::mul"; } std::string name() const { return "gpu::mul"; }
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument compute(context&, const shape&, const std::vector<argument>& args) const; argument compute(context&, const shape&, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -29,6 +29,7 @@ struct miopen_pooling ...@@ -29,6 +29,7 @@ struct miopen_pooling
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -27,6 +27,7 @@ struct miopen_relu ...@@ -27,6 +27,7 @@ struct miopen_relu
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
...@@ -27,6 +27,7 @@ struct miopen_softmax ...@@ -27,6 +27,7 @@ struct miopen_softmax
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment