Skip to content
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

[RUST][RUNTIME] Fix workspace #5503

Merged
merged 2 commits into from
May 4, 2020
Merged

Conversation

kazum
Copy link
Contributor

@kazum kazum commented May 3, 2020

  • !ws_size >= size means (!ws_size) >= size, which is obviously wrong.
  • Return error when an invalid pointer is passed to TVMBackendFreeWorkspace.

@jroesch @nhynes @ehsanmok Please help to review.

Copy link
Member

@nhynes nhynes left a comment

Choose a reason for hiding this comment

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

nice catch. for reference, this never failed because there's ever one workspace alive at once

if let Some(ws_idx) = ws_idx {
self.free.push(ws_idx);
}
let ws_idx = ws_idx.ok_or(format_err!("Invalid pointer"))?;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let ws_idx = ws_idx.ok_or(format_err!("Invalid pointer"))?;
let ws_idx = ws_idx.ok_or_else(|_| format_err!("Invalid pointer"))?;

@tqchen tqchen merged commit 7e88030 into apache:master May 4, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 9, 2020
* [RUST][RUNTIME] Fix workspace

* use ok_or_else instead of ok_or
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 18, 2020
* [RUST][RUNTIME] Fix workspace

* use ok_or_else instead of ok_or
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 18, 2020
* [RUST][RUNTIME] Fix workspace

* use ok_or_else instead of ok_or
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.

3 participants