-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Testing 1.8.2 PR changes #38
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
@h-vetinari ok this should be basically working! Kaldi dlls are built for windows, and it uses OpenFST from conda forge now. Massive patch as it incorporates the changes in kaldi-asr/kaldi#4829 as well as fixes on top. I've submitted my changes to georgthegreat/kaldi#1, so hopefully once those get merged in we can get the OpenFST 1.8.2 PR merged. |
Haven't reviewed the patches but that sounds great, thanks a lot @mmcauliffe! :) |
@h-vetinari Since there hasn't been any movement on either of the upstream PRs, I'm wondering if you could take a look over this? https://github.com/mmcauliffe/kaldi/tree/conda-shared is the branch that the patches are based on. I have a couple of projects that have dependencies on this. I've been working on pybind11 bindings for the shared libraries and the basic functionality is working for calling Kaldi feature generation and decoding graph compilation functions from Python, so it'd be nice to get that released and integrated into MFA. |
Hey @mmcauliffe, sorry I missed this ping in my flood of notifications 😑 |
Looking at mmcauliffe/kaldi@2d2e057, I have to wonder if all those typdef changes are really necessary? They seem pretty harmless, and blow up the patch for no good reason. That said: whatever. I'm not a huge fan of the following: #ifdef kaldi_base_BUILT_AS_STATIC
# define kaldi_base_EXPORT
# define KALDI_base_NO_EXPORT
#else
#ifdef _WIN32
# ifndef kaldi_base_EXPORT
# ifdef kaldi_base_EXPORTS
/* We are building this library */
# define kaldi_base_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define kaldi_base_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef KALDI_BASE_NO_EXPORT
# define KALDI_BASE_NO_EXPORT
# endif
#else
#define kaldi_base_EXPORT
#endif // _WIN32
#endif for various reasons:
I prefer to be explicit by setting the required symbols explicitly. I did this recently for another windows DLL-ification project (with the mechanism based on what abseil is doing), which would look like #if defined(KALDI_DLL_EXPORTS)
# define KALDI_DLL __declspec(dllexport)
#elif defined(KALDI_DLL_IMPORTS)
# define KALDI_DLL __declspec(dllimport)
#else
# define KALDI_DLL
#endif // defined(KALDI_DLL_EXPORTS) where the key CMake addition is if(BUILD_SHARED_LIBS)
set_target_properties(<target> PROPERTIES DEFINE_SYMBOL "KALDI_DLL_EXPORTS")
target_compile_definitions(<target> INTERFACE KALDI_DLL_IMPORTS)
endif() By putting that in the interface, each consuming library automatically gets the right |
Yeah, they're a consequence of the changes here: https://github.com/kaldi-asr/kaldi/pull/4829/files#diff-338cced3fed5be3eaa511ced41fe5d8d2ddf826d0468f2d8c06edb62f3f6d042L42 where typedefs were moved from the Kaldi namespace to the global one. There's some discussion of it kaldi-asr/kaldi#4829 but not resolved, so I just went with the new version, but if you think it's better just to revert the scoping of the type defs and keep the
That does seem cleaner, I was basing the original exports header file based on what cmake was generating from https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html, but I'll do it this way since it seems a lot less confusing. |
From what I can tell by looking at the linked diff, there should be no functional difference and it's "just" a question of consistency? If so, that doesn't meet the level for inclusion into the patch here IMO, especially not if we get thousands of lines of raw patch file that drown out the relevant changes. So if you're already reworking this, I'd prefer to drop those changes. If however it's necessary from a functional POV (e.g. it doesn't compile without, or would produce the wrong results), then go ahead and leave them in. |
@h-vetinari ok, got everything working again, rolled back the typedef changes and used the template you had for DLL exports. One thing I ran into is that I had to explicitly pass the relevant DLL_IMPORT definition to cuda_compile for some reason, it wasn't getting picked up somehow when linking to the library with the symbols. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting to look very good. Just some nits & questions
diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h | ||
index 68d5578..3a1b8b9 100644 | ||
--- a/src/base/kaldi-types.h | ||
+++ b/src/base/kaldi-types.h | ||
@@ -39,16 +39,30 @@ typedef float BaseFloat; | ||
// we find in the future lacks stdint.h | ||
#include <stdint.h> | ||
|
||
-typedef int8_t int8; | ||
-typedef int16_t int16; | ||
-typedef int32_t int32; | ||
-typedef int64_t int64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems to be duplicated with patch 3. Probably it passes because patch
recognizes it has already been applied...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I did one patch for the 1.82 changes on the original PR and then another patch on top of those with my changes to get it working, just to keep it separate, but getting rid of the typedefs meant that I undid what was done in the original PR.
// should call CuDevice::Instantiate().SelectGpuId(..). | ||
static CuDevice& Instantiate() { | ||
- CuDevice &ans = this_thread_device_; | ||
+ CuDevice &ans = this_thread_device(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it seems you picked up a few tricks from the gprc work? ;-)
Or if you found out how to deal with thread_local
vs. __declspec(dllexport)
independently, I doff my hat!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I meant to mention! I noticed you had a workaround in a follow up commit, so used that here, no hat doffing required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't come up with that workaround myself either, I had been completely stuck (hence I'd have been impressed if you had come up with it by yourself 🙃)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, this LGTM! Thanks so much! :)
The one thing I'd like to avoid is having the multiple thousand-line patch churn in the git history. Would you mind rebasing the PR to clean up the history a bit, or are you fine with a squash merge? I'm also willing to do something manually to separate the recipe rerendering from your commits (an intelligent squash merge, if you will). |
I usually squash merge, so if that's alright with you, I can just do that for this one too. |
Go ahead! :) |
Checklist
0
(if the version changed)conda-smithy
(Use the phrase@conda-forge-admin, please rerender
in a comment in this PR for automated rerendering)Testing out changes from kaldi-asr/kaldi#4829 that updates Kaldi to use OpenFST 1.8.2