Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Make useLazyTensor a thread-local state. #387

Merged
merged 2 commits into from
Jul 25, 2019

Conversation

bgogul
Copy link
Contributor

@bgogul bgogul commented Jul 24, 2019

No description provided.

@bgogul bgogul requested a review from pschuh July 24, 2019 18:11
}
}

private var lazyTensorEnabled: Bool? = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may not always be set. If this is not set, we should use the global _RuntimeConfig.useLazyTensor property to determine if lazy tensor is enabled. I added a comment to explain this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, isn't using the global _RuntimeConfig.useLazyTensor still not thread-safe? Would it make sense to make this flag the only one?

}
}

private var lazyTensorEnabled: Bool? = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, isn't using the global _RuntimeConfig.useLazyTensor still not thread-safe? Would it make sense to make this flag the only one?

@bgogul
Copy link
Contributor Author

bgogul commented Jul 24, 2019

Hmm, isn't using the global _RuntimeConfig.useLazyTensor still not thread-safe? Would it make sense to make this flag the only one?

_RuntimeConfig.useLazyTensor should only be written to once at the start of the program and read afterwards.

@bgogul bgogul force-pushed the use_lazy_tensor_local branch from 86a891c to 75cadef Compare July 24, 2019 21:21
@bgogul
Copy link
Contributor Author

bgogul commented Jul 25, 2019

Hmm, isn't using the global _RuntimeConfig.useLazyTensor still not thread-safe? Would it make sense to make this flag the only one?

_RuntimeConfig.useLazyTensor should only be written to once at the start of the program and read afterwards.

Also, _RuntimeConfig.useLazyTensor is a temporary flag until we make lazy tensor the default behavior in code.

@bgogul bgogul merged commit 2f75a2d into tensorflow:master Jul 25, 2019
@bgogul bgogul deleted the use_lazy_tensor_local branch July 25, 2019 00:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants