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

Fix AffineTransform.rotate(byRadians:) implementation. #3012

Merged
merged 13 commits into from
Feb 16, 2022

Conversation

filip-sakel
Copy link
Contributor

This PR makes rotate(byRadians:) cumulative. The implementation is corrected; however, test coverage hasn't been added.

@millenomi
Copy link
Contributor

@filip-sakel are you interested in adding a test for this so I can merge?

@filip-sakel
Copy link
Contributor Author

I'll probably be done by the day after tomorrow because I'm also updating some legacy code.

@filip-sakel filip-sakel marked this pull request as ready for review August 27, 2021 22:38
@spevans
Copy link
Collaborator

spevans commented Aug 27, 2021

@swift-ci test

@spevans
Copy link
Collaborator

spevans commented Aug 29, 2021

I ran the tests against BigSur 11.5's Foundation using the DarwinCompatibilityTests project and there was a few test failures (unless these work in Monterrey or Darwin is also buggy)?

@filip-sakel
Copy link
Contributor Author

filip-sakel commented Aug 29, 2021

OK, I looked at the failing tests and these seem to be the issues:

  1. Point/Size transform mismatch
    I erroneously assumed that since both are vectors their transformations should be equivalent — whereas Size shouldn’t be translated; I’ll fix that.
  2. Combination Tests
    I think the tests are correct here; the issue seems to be that Darwin Foundation prepends new transformations rather than appending them. For example, inverting the order of operations in either check in testTranslationScaling() yields only the point/size error.
  3. Hashing (EDIT)
    The tests iterate over an array of unique samples testing if the hash value between the same sample matches and if it differs from the other samples; the latter seems to be failing on Darwin.

@filip-sakel
Copy link
Contributor Author

I fixed the size transformation; let me know if there's any other issue.

@MaxDesiatov
Copy link
Member

@swift-ci please test

@filip-sakel
Copy link
Contributor Author

There seems to be a Swift test failure on linux. I fetched apple:main, so the problem should be fixed.

@MaxDesiatov could you please try another CI validation?

@MaxDesiatov
Copy link
Member

@swift-ci please test

@MaxDesiatov
Copy link
Member

The error is caused by TestAffineTransform.swift:52:17: error: cannot find type 'CGVector' in scope

@filip-sakel
Copy link
Contributor Author

Thanks, Max; I didn't notice this error on the first CI build.

I've updated the code to use a new Vector type instead of the Darwin-only CGVector.

@MaxDesiatov
Copy link
Member

@swift-ci please test

@AtariDreams
Copy link
Contributor

Any update on this?

@millenomi
Copy link
Contributor

@swift-ci please test and merge

@millenomi
Copy link
Contributor

It fell through the cracks, but it was good.

@MaxDesiatov
Copy link
Member

@swift-ci please test macOS platform

@MaxDesiatov
Copy link
Member

The macOS CI failure is caused by the this assertion in the compiler:

1.	Swift version 5.7-dev (LLVM 5ea1e5e020828d8, Swift ac875d00f04126d)
2.	Compiling with the current language version
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote } on SIL for SwiftFoundation)
4.	While running pass #2144137 SILModuleTransform "SerializeSILPass".
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000109236cf7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x0000000109235c18 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x0000000109237340 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007fff20447d7d _sigtramp + 29
4  swift-frontend           0x000000010bcd4000 llvm::CSR_Altivec_SaveList + 319024
5  libsystem_c.dylib        0x00007fff20357411 abort + 120
6  libsystem_c.dylib        0x00007fff203567e8 err + 0
7  swift-frontend           0x00000001097bcb33 swift::ModuleDecl::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const (.cold.1) + 35
8  swift-frontend           0x00000001054ae652 swift::ModuleDecl::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 882
9  swift-frontend           0x00000001046bcbd4 swift::ModuleFile::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) + 36
10 swift-frontend           0x00000001054ae34f swift::ModuleDecl::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 111
11 swift-frontend           0x00000001054ae5fa swift::ModuleDecl::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 794
12 swift-frontend           0x0000000104415af0 swift::getTopLevelDeclsForDisplay(swift::ModuleDecl*, llvm::SmallVectorImpl<swift::Decl*>&) + 32
13 swift-frontend           0x00000001041d4e56 swift::ide::api::SwiftDeclCollector::lookupVisibleDecls(llvm::ArrayRef<swift::ModuleDecl*>) + 134
14 swift-frontend           0x00000001041d8886 swift::ide::api::dumpModuleContent(swift::ModuleDecl*, llvm::StringRef, bool) + 230
15 swift-frontend           0x00000001046e304c swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::symbolgraphgen::SymbolGraphOptions const&, swift::SILModule const*, swift::fine_grained_dependencies::SourceFileDepGraph const*) + 620
16 swift-frontend           0x00000001041e7ff9 bool llvm::function_ref<bool (swift::fine_grained_dependencies::SourceFileDepGraph&&)>::callback_fn<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_26::operator()() const::'lambda'(swift::fine_grained_dependencies::SourceFileDepGraph&&)>(long, swift::fine_grained_dependencies::SourceFileDepGraph&&) + 41
17 swift-frontend           0x0000000105451c87 swift::fine_grained_dependencies::withReferenceDependencies(llvm::PointerUnion<swift::ModuleDecl const*, swift::SourceFile const*>, swift::DependencyTracker const&, llvm::StringRef, bool, llvm::function_ref<bool (swift::fine_grained_dependencies::SourceFileDepGraph&&)>) + 151
18 swift-frontend           0x00000001041e7f7d std::__1::__function::__func<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_26, std::__1::allocator<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_26>, void ()>::operator()() + 285
19 swift-frontend           0x00000001042ef2e4 swift::SILModule::serialize() + 36
20 swift-frontend           0x0000000104c11c71 SerializeSILPass::run() + 145
21 swift-frontend           0x0000000104ab3fe1 swift::SILPassManager::runModulePass(unsigned int) + 689
22 swift-frontend           0x0000000104ab912a swift::SILPassManager::execute() + 634
23 swift-frontend           0x0000000104ab0d58 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 72
24 swift-frontend           0x0000000104ab0cf3 swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 51
25 swift-frontend           0x0000000104ad201d swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 29
26 swift-frontend           0x0000000104abbee1 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 241
27 swift-frontend           0x0000000104ab0f84 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 68
28 swift-frontend           0x0000000104abf0f7 swift::runSILOptimizationPasses(swift::SILModule&) + 151
29 swift-frontend           0x00000001042492c0 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 688
30 swift-frontend           0x00000001041e42dd performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 637
31 swift-frontend           0x00000001041e3eea swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 2218
32 swift-frontend           0x00000001041e5b99 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3641
33 swift-frontend           0x0000000104108047 swift::mainEntry(int, char const**) + 503
34 libdyld.dylib            0x00007fff2041df3d start + 1
error: Abort trap: 6 (in target 'SwiftFoundation' from project 'Foundation')

@MaxDesiatov
Copy link
Member

Please test with following PRs:
swiftlang/swift#41115

@swift-ci please test macOS platform

@MaxDesiatov
Copy link
Member

@millenomi would you mind if this is merged?

@millenomi
Copy link
Contributor

Only after swiftlang/swift#41115 is merged.

@millenomi
Copy link
Contributor

Per discussion: other patches have gone in, do not block on 41115. Merging.

@millenomi millenomi merged commit cc90ac5 into apple:main Feb 16, 2022
@millenomi
Copy link
Contributor

(The checks on the last round weren't done, but checks prior to that were green and there were no patch changes.)

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.

None yet

5 participants