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

[SR-8613] [blocker] @inlinable functions defined in separate Jupyter/REPL units do not get inlined during deabstraction #51128

Closed
marcrasi mannequin opened this issue Aug 23, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. GPE s4tf iris tutorial swift for tensorflow

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Aug 23, 2018

Previous ID SR-8613
Radar None
Original Reporter @marcrasi
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Swift for TensorFlow
Labels Bug, GPE, s4tf-iris-tutorial
Assignee bgogul (JIRA)
Priority Medium

md5: 2d05d092c84c845d553659edb032ed74

Issue Description:

For a minimal reproducer, execute the following two cells in Juptyer or REPL:

import TensorFlow

@inlinable @inline(__always)
public func dataset() -> Tensor<Float> {
    return Tensor(1)
}
_hostOp(dataset())

You should get the following error:

 !!! Compiler bug -- Tensor op builtin __tfop_tfc.scalarToTensor,$in cannot be lowered to LLVM IR !!!

I'll attach a `-tf-dump-intermediates` for the compilation of the `_hostOp(dataset())` cell. If you look at it, you'll see that the dataset function is not getting inlined during deabstraction.

This blocks us from defining a single `dataset()` function that constructs a dataset in the tutorial.

This error is suspiciously similar to SR-8589.

@swift-ci
Copy link
Collaborator

swift-ci commented Sep 7, 2018

Comment by Gogul Balakrishnan (JIRA)

As noted in SR-8589, lldb throws away SIL modules after parsing a REPL line and prevent us from seeing the bodies of some functions during deabstraction. This bug is also caused by the same problem.

One way to deal with this is to serialize the SIL module of every REPL line and make them an additional import when evaluating subsequent lines. lldb_serialize.patch (based off of commit 46dcbd5a551749b1e497013368e9252e9c0b886f) is an POC hack to implement this idea. The hack makes this example work, but is not robust enough to push to upstream yet.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. GPE s4tf iris tutorial swift for tensorflow
Projects
None yet
Development

No branches or pull requests

1 participant