Skip to content

Print input/output values for each dispatch function in DEBUG mode - #2605

Merged
hanhanW merged 2 commits into
iree-org:mainfrom
hanhanW:debug-io
Jul 22, 2020
Merged

hanhanW merged 2 commits into
iree-org:mainfrom
hanhanW:debug-io

Conversation

@hanhanW

@hanhanW hanhanW commented Jul 21, 2020

Copy link
Copy Markdown
Contributor

Fixes #2305

Trace point for dispatchable functions.
}];

let arguments = (ins Variadic<AnyType>:$operands);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can change this to Variadic<FLOW_Tensor>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return failure();
}

#ifndef NDEBUG

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's worth making this a runtime flag - like iree-flow-trace-dispatch-tensors - so that this is possible to enable from python/etc without recompiling

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Yeah, it's easier to use if make it a runtime flag.

}

#ifndef NDEBUG
builder.create<TensorTraceOp>(regionOp.getLoc(), newArgs);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this just traces tensors you'll want to filter newArgs/dispatchOp.getResults() below for just things of TensorType

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Location loc = traceOp.getLoc();
SmallVector<Value, 4> bufferViews;
for (auto operand : llvm::enumerate(rawOperands)) {
if (!IREE::HAL::TensorRewriteAdaptor::isValidNewType(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove this check if the arguments are filtered to just tensors above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

SymbolTable &importSymbols,
TypeConverter &typeConverter,
OwningRewritePatternList &patterns) {
patterns.insert<VMImportOpConversion<IREE::HAL::BufferViewTraceOp>>(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move to bottom so this order matches the order in the HALOps.td

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, missed this during cleanup. Done.

@benvanik
benvanik self-requested a review July 22, 2020 14:32
@hanhanW
hanhanW merged commit 9624bbb into iree-org:main Jul 22, 2020
@hanhanW
hanhanW deleted the debug-io branch July 22, 2020 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print input/output values for each dispatch function to help debugging

3 participants