Skip to content

Deprecate legacy hdfs file system - #46955

Merged
copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
yongtang:deprecate-hdfs
Feb 9, 2021
Merged

copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
yongtang:deprecate-hdfs

Conversation

@yongtang

@yongtang yongtang commented Feb 5, 2021 •

Copy link
Copy Markdown
Member

This PR is part of the effort to switch to modular file system support
by deprecates hdfs file system and direct user to use modular file system
from tensorflow-io instead.

A TF_ENABLE_LEGACY_FILESYSTEM=1 will allow the usage of legacy hdfs file
system the same way as before (a warning will be displayed).

/cc @mihaimaruseac @vnvo2409 @tensorflow/sig-io-maintainers @burgerkingeater

Update: See related changes in tensorflow/io#1309 where hdfs is enabled in tensorflow/io.

Signed-off-by: Yong Tang [email protected]

This PR is part of the effort to switch to modular file system support
by deprecates hdfs file system and direct user to use modular file system
from tensorflow-io instead.

A `TF_ENABLE_LEGACY_FILESYSTEM=1` will allow the usage of legacy hdfs file
system the same way as before (a warning will be displayed).

Signed-off-by: Yong Tang <[email protected]>
@google-ml-butler google-ml-butler Bot added the size:S CL Change Size: Small label Feb 5, 2021
@google-cla google-cla Bot added the cla: yes label Feb 5, 2021
@gbaned gbaned self-assigned this Feb 5, 2021
@gbaned gbaned added the comp:core issues related to core part of tensorflow label Feb 5, 2021
return;
}
LOG(WARNING) << "Legacy file system for '" << scheme << "' is deprecated"
<< " and will be removed in tensorflow 2.6 or higher."

@kvignesh1420 kvignesh1420 Feb 8, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@yongtang aren't we looking at TensorFlow 2.5 release for the filesystem migration?
cc: @mihaimaruseac

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@kvignesh1420 If the PR can be merged before upcoming 2.5, then hdfs will be deprecated in 2.5 (with the option of using TF_ENABLE_LEGACY_FILESYSTEM=1 to keep in legacy mode), in 2.6 or higher we can consider completely remove hdfs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we have this env var documented somewhere?

@yongtang yongtang added the kokoro:force-run Tests on submitted change label Feb 8, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Feb 8, 2021
@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Feb 8, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Feb 8, 2021
@burgerkingeater

Copy link
Copy Markdown
Member

@yongtang thanks for the PR. does it mean after tf 2.5 or 2.6, HDFS access from TF is officially supported from tensorflow IO?

@yongtang

yongtang commented Feb 8, 2021

Copy link
Copy Markdown
Member Author

@burgerkingeater Yes that is the plan. Refers to SIG IO's monthly meeting notes:
https://docs.google.com/document/d/1CB51yJxns5WA4Ylv89D-a5qReiGTC0GYum6DU-9nKGo/edit#heading=h.xjrh565dirib

@copybara-service
copybara-service Bot merged commit e920f7a into tensorflow:master Feb 9, 2021
@yongtang
yongtang deleted the deprecate-hdfs branch February 9, 2021 00:39
copybara-service Bot pushed a commit that referenced this pull request Aug 12, 2026
…t-count mismatch in the HLO parser

Imported from GitHub PR openxla/xla#47057

## 📝 Summary of Changes

Validate reshape and dynamic-reshape invariants in
`HloParserImpl::CreateInstruction` before calling the `HloInstruction`
factories, so malformed HLO text gets a parse error instead of a fatal
CHECK.

## 🎯 Justification

Fixes #46955.

Parsing HLO text where a `reshape` (or `dynamic-reshape`) output shape has a
different element count than its operand kills the process:
`HloInstruction::CreateReshape` / `CreateDynamicReshape` enforce the
invariant with fatal `CHECK`s, and the text parser calls them unguarded. The
proto path already guards the exact same invariants with Status-returning
`TF_RET_CHECK` in `CreateFromProto`; this change gives the text parser the
same treatment, using the parser's `TokenError` so the message carries
line/column context.

Three cases are covered (the third is not in the issue but is the same hole):

- `reshape` with mismatched element count (respecting the factory's
  unbounded-dynamic operand escape),
- `dynamic-reshape` with mismatched element count,
- `dynamic-reshape` with the wrong number of dim-size operands.

The factory CHECKs themselves are intentionally left alone; every internal
caller guarantees the invariant, and weakening them would hide real bugs.

Two scope notes. The guards mirror the proto path exactly, which is slightly
stricter than the factory CHECK for non-array shapes (e.g. reshaping a token
now gets a parse error; it previously parsed and then failed in the verifier,
and DCHECK-crashed debug builds). And the same bug class exists for
`replica-id`/`partition-id` with an explicit non-`u32[]` shape (their
factories CHECK the shape); left out of scope here since #46955 is about
reshape, can file a follow-up.

## 🚀 Kind of Contribution

🐛 Bug Fix

## 🧪 Unit Tests:

Four tests in `xla/hlo/parser/hlo_parser_test.cc`: three negative
(`ParseReshapeElementCountMismatch`,
`ParseDynamicReshapeElementCountMismatch`,
`ParseDynamicReshapeDimSizeOperandCountMismatch`) that crash the test binary
with the issue's exact CHECK signature without the parser change and pass
with it, plus `ParseReshapeUnboundedDynamicOperandStillParses` pinning the
unbounded-dynamic escape hatch. Full `//xla/hlo/parser:hlo_parser_test` and
`//xla/service:hlo_verifier_test` pass.

## 🧪 Execution Tests:

None needed; the change is parse-time only (CPU, no accelerator involved).
Copybara import of the project:

--
a2800f43eeba129c1085f183cb9c575014cdcd2c by Stanislav Bardyuk <[email protected]>:

Return a parse error instead of crashing on reshape element-count mismatch

The HLO text parser called HloInstruction::CreateReshape and
CreateDynamicReshape without validating their preconditions, so malformed
input crashed the process on the factories' fatal CHECKs: element-count
mismatch between result and operand, and a wrong number of dynamic-reshape
dim size operands. The proto path already guards the same invariants with
TF_RET_CHECK in CreateFromProto. Validate in the parser and return a
line-anchored parse error instead, keeping the factory CHECKs and the
unbounded-dynamic operand exemption intact.

Fixes #46955.

Merging this change closes #47057

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#47057 from kodlan:fix/issue-46955-parser-reshape-crash a2800f43eeba129c1085f183cb9c575014cdcd2c
PiperOrigin-RevId: 963258845
copybara-service Bot pushed a commit that referenced this pull request Aug 12, 2026
…t-count mismatch in the HLO parser

Imported from GitHub PR openxla/xla#47057

## 📝 Summary of Changes

Validate reshape and dynamic-reshape invariants in
`HloParserImpl::CreateInstruction` before calling the `HloInstruction`
factories, so malformed HLO text gets a parse error instead of a fatal
CHECK.

## 🎯 Justification

Fixes #46955.

Parsing HLO text where a `reshape` (or `dynamic-reshape`) output shape has a
different element count than its operand kills the process:
`HloInstruction::CreateReshape` / `CreateDynamicReshape` enforce the
invariant with fatal `CHECK`s, and the text parser calls them unguarded. The
proto path already guards the exact same invariants with Status-returning
`TF_RET_CHECK` in `CreateFromProto`; this change gives the text parser the
same treatment, using the parser's `TokenError` so the message carries
line/column context.

Three cases are covered (the third is not in the issue but is the same hole):

- `reshape` with mismatched element count (respecting the factory's
  unbounded-dynamic operand escape),
- `dynamic-reshape` with mismatched element count,
- `dynamic-reshape` with the wrong number of dim-size operands.

The factory CHECKs themselves are intentionally left alone; every internal
caller guarantees the invariant, and weakening them would hide real bugs.

Two scope notes. The guards mirror the proto path exactly, which is slightly
stricter than the factory CHECK for non-array shapes (e.g. reshaping a token
now gets a parse error; it previously parsed and then failed in the verifier,
and DCHECK-crashed debug builds). And the same bug class exists for
`replica-id`/`partition-id` with an explicit non-`u32[]` shape (their
factories CHECK the shape); left out of scope here since #46955 is about
reshape, can file a follow-up.

## 🚀 Kind of Contribution

🐛 Bug Fix

## 🧪 Unit Tests:

Four tests in `xla/hlo/parser/hlo_parser_test.cc`: three negative
(`ParseReshapeElementCountMismatch`,
`ParseDynamicReshapeElementCountMismatch`,
`ParseDynamicReshapeDimSizeOperandCountMismatch`) that crash the test binary
with the issue's exact CHECK signature without the parser change and pass
with it, plus `ParseReshapeUnboundedDynamicOperandStillParses` pinning the
unbounded-dynamic escape hatch. Full `//xla/hlo/parser:hlo_parser_test` and
`//xla/service:hlo_verifier_test` pass.

## 🧪 Execution Tests:

None needed; the change is parse-time only (CPU, no accelerator involved).
Copybara import of the project:

--
a2800f43eeba129c1085f183cb9c575014cdcd2c by Stanislav Bardyuk <[email protected]>:

Return a parse error instead of crashing on reshape element-count mismatch

The HLO text parser called HloInstruction::CreateReshape and
CreateDynamicReshape without validating their preconditions, so malformed
input crashed the process on the factories' fatal CHECKs: element-count
mismatch between result and operand, and a wrong number of dynamic-reshape
dim size operands. The proto path already guards the same invariants with
TF_RET_CHECK in CreateFromProto. Validate in the parser and return a
line-anchored parse error instead, keeping the factory CHECKs and the
unbounded-dynamic operand exemption intact.

Fixes #46955.

Merging this change closes #47057

PiperOrigin-RevId: 963339001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes comp:core issues related to core part of tensorflow ready to pull PR ready for merge process size:S CL Change Size: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants