Commit Graph

60 Commits

Author SHA1 Message Date
Bin Bao
ac37ddc795 [LT] Store OpKind for each IR subclass in a static field
Summary: Currently OpKind is stored as an object field called op_ for each IR
node, and one usage of op_ is to avoid dynamic_cast in NodeCast when we
need to downcast a base-node pointer into a concrete sub-node pointer.
As a result, we need to construct and pass in an op when downcasting
nodes, and this becomes quite anonnying when we start to implement the
trie-based IR node reusing. More importantly, the op for each subclass
should be unique for that subclass and thus making it a const static field
is a more logical design.

In this PR, we still keep the object-level op_ for easier XLA adoption. As
furture work, we can come back to remove op_, make the op() method
virtual, and get rid of OpKind in all the node constructors.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/76711

Approved by: https://github.com/wconstab, https://github.com/JackCaoG
2022-05-06 19:14:46 +00:00
mikey dagitses
37fb636b7f fix package violation caused by D35587412 (#76808)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76808

This reached into aten/TARGETS in fbcode.
ghstack-source-id: 155484095

Test Plan: Verified manually.

Reviewed By: dreiss, malfet

Differential Revision: D36128458

fbshipit-source-id: c7447b3a40fe905993e799d211241e72183f8acb
(cherry picked from commit b68eb7a45d8973fadab2dfcafcbb0f63801abd40)
2022-05-05 23:39:03 +00:00
mikey dagitses
ac45fb9b93 switch Bazel to the shared generate-code genrule (#75790)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75790

We were building it before, but now we use it in downstream
rules. This enables us to eliminate the handwritten genrule.
ghstack-source-id: 155300051

Test Plan: Verified locally and in CI.

Reviewed By: dreiss

Differential Revision: D35645390

fbshipit-source-id: 478bb37a6ec295c232f66383babf46606e83ed5e
(cherry picked from commit 2822d4c5b48c6d9282149b2d43cf72d645237196)
2022-05-04 15:26:25 +00:00
mikey dagitses
096ff0ecca introduce new --gen-dir flag to generate_code and use it in fbcode (#75800)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75800

This leads to more similarities between OSS CMake and eventually OSS
Bazel. We will be able to generate files with the same names and not
have different file lists between the builds.
ghstack-source-id: 155300043

Test Plan: Verified locally and in CI.

Reviewed By: dreiss

Differential Revision: D35648586

fbshipit-source-id: 9f1638b5665ebcc64466883f65ef24a2bfd05228
(cherry picked from commit 7f2acff1baa8dfafddefdc720714f8d39feda436)
2022-05-04 15:26:25 +00:00
mikey dagitses
401179f263 disable the //:generate-code target in Bazel (#76174)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76174

This is about to conflict with the existing Bazel codegen
outputs. Switch to it atomically.
ghstack-source-id: 155029309

Test Plan: Verify manually and rely on CI.

Reviewed By: dreiss

Differential Revision: D35815288

fbshipit-source-id: 8b35e7baeb8572aef13c07cac689ee84dc7335d5
(cherry picked from commit 6dde9831a30fcf664b73fccaa51e30a7049b3251)
2022-05-03 12:13:19 +00:00
mikey dagitses
eb27c85160 move generate-code into shared build structure (#75699)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75699

ghstack-source-id: 155255334

Test Plan: Rely on CI.

Reviewed By: dreiss

Differential Revision: D35587412

fbshipit-source-id: 5ab79c07029de279a1fae36519654a73bb61d430
(cherry picked from commit 4896b72a6c0cc087e36889d21d2d885009d94a6d)
2022-05-03 09:53:37 +00:00
mikey dagitses
8b1cf8ed6b move version_h to shared build structure in Buck (#75964)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75964

This is already in the shared build structure for Bazel, but we need
to implement genrule for fbcode.

There's an xplat target that can't build in fbcode yet because the
dependencies don't line up, so we have to add a tag to exclude it.

ghstack-source-id: 154696020

Test Plan: Rely on CI

Reviewed By: malfet

Differential Revision: D35443900

fbshipit-source-id: 0768b29906c8218d7aebfdc7c18d69f59a0c9384
(cherry picked from commit bff47be441bd142392a07aa177be02e18aa86f1c)
2022-04-26 12:06:09 +00:00
mikey dagitses
f4200600e4 move Bazel version header generation to shared build structure (#75332)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75332

ghstack-source-id: 154678044

Test Plan: Rely on OSS CI.

Reviewed By: malfet

Differential Revision: D35434229

fbshipit-source-id: 7cdd33fa32d0c485f44477e414c24c9bc4b74963
(cherry picked from commit 60285c613e8703c52f36f0bf1178e35c04574ffa)
2022-04-25 17:51:30 +00:00
mikey dagitses
d78dd825ba define the caffe2_serialize target in Bazel (#75942)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75942

This also requires changes to the target definition and the xplat translator to get it working.
ghstack-source-id: 154678046

Test Plan: Verify locally and rely on CI.

Reviewed By: malfet

Differential Revision: D35704597

fbshipit-source-id: 6b0d9f5a044609b24dda656f80233ba6186c097f
(cherry picked from commit 6de43c5ca7a973c9f8b71f4d60d4d5e85cc2ba21)
2022-04-25 16:14:05 +00:00
Sergii Dymchenko
a5b4839f35 Move //xplat/caffe2:caffe2_serialize to shared build structure
Summary: This is a first step to migrate xplat targets to shared build structure. Eventually both xplat buck and open source bazel targets will be generated from shared build.bzl.

Test Plan: Should be no-op, rely on CI.

Reviewed By: malfet

Differential Revision: D35270004

Pull Request resolved: https://github.com/pytorch/pytorch/pull/75847
Approved by: https://github.com/linbinyu
2022-04-15 17:25:29 +00:00