Commit Graph

3656 Commits

Author SHA1 Message Date
Mehrdad Hessar dc522a6ff6 [Hexagon] Run single RPC server on Android in each testing session (#11547)
* Reuse hexagon launcher in test session

* separate random name generation

* revert get_aot_executor

* Fix launcher for simulator case

* add stop server for simulator
2022-06-10 16:33:24 -05:00
Nicola Lancellotti e7f793d0ad Add assert message (#11665)
Change-Id: I88f19c7105cce048d2f52d50450a551fb12162dc
2022-06-10 17:31:13 +01:00
Qianshui f117244ac4 [DNNL][Relay extern-schedule] DNNL Conv2D Kernel enable by assigning "-libs=mkldnn" (#11571)
* enable oneDNN conv op by using -libs=mkldnn

* add channel last format support and let oneDNN chose blocked format.

* remove unnecessary changes

* reformat 3 files

* reformat 1 file

* change the argument name

* change the argument name

* rename the arguments

* fix cpp lint issue

* fix cpp lint issue

* fix cpp lint issue

* clang reformated

* adjust .py import for testing

* function existence check in test
2022-06-10 20:59:09 +09:00
Junru Shao 6fca5c657a [MetaSchedule] Developer Ergonomics Enhancement (#11622)
Per discussion with @Kathryn-cat

- [x] Move `initialize_with_tune_context` as private API `_initialize_with_tune_context`, and
encourage using `TuneContext.initialize`
- [x] Instead of using bunch of import statements, encourage using `ms.xxx` as the prefix
(e.g. `ms.database.MemoryDatabase`) to organize things better
- [x] Move `DefaultLLVM`, `DefaultCUDA` to a separate file and make them more discoverable
- [x] Move `DummyDatabase` to `tvm.meta_schedule.database.MemoryDatabase` given it's actually useful
- [x] Delegate class members' methods in `TuneContext`, for example, having
`TuneContext.generste_design_space` from `TuneContext.space_generator.generste_design_space`

Next PR:
- Allow using a string `"default"` in `TuneContext` as well as `tune_relay/tir/te` to quickly
specify a set of target-specific rules
- Add `TuneContext.tune` to allow directly tuning without task scheduler.
- Enhance detection of `ScheduleFn` in `TuneContext` to make it easier for users to quickly try out
template-driven scheduling on TIR.

Co-Authored-By: Kathryn (Jinqi) Chen <65606304+Kathryn-cat@users.noreply.github.com>
2022-06-09 22:09:40 -07:00
Masahiro Masuda 53d163c968 [TIR, CUDA] Add pass to replace global to shared memory copy with cp.async (#11658)
* [TIR, CUDA] Add pass to replace global to shared memory copy with cp.async

* add missing doc

* black

* missing src

* clang format

* clang format

* check against nested async scope
2022-06-09 19:05:18 -07:00
Tristan Konolige fe299d7688 [TVMSCRIPT] Improve tvmscript type hints (#11654)
* [TVMSCRIPT] Improve tvmscript type hints

- Change numeric types to classes so they work as function arguments.
- Add var as a class.
- Add floordiv, index, and mod to PrimExpr.

* use Union
2022-06-09 17:45:36 -07:00
Gavin Uberti 762bed0d0d [microTVM] Add support for Arduino Portenta H7 (#11636)
* Add support for Portenta H7

* Add Portenta H7 to supported boards in README

* Rerun tests
2022-06-10 08:58:35 +09:00
Eric Lunderberg af0128158c [TIR][Schedule] Allow named block and buffer arguments in Schedule (#11624)
* [Schedule] Allowed string argument as block arg

This has previously been implemented for `Schedule.transform_layout`
in https://github.com/apache/tvm/pull/11296, extending to allow for
block arguments in all `Schedule` methods.

This change was only made for arguments that must be a `BlockRV`.  For
arguments that may be either a `BlockRV` or another
type (e.g. `Schedule.get_child_blocks` accepts either `BlockRV` or
`LoopRV`), this sugar is not implemented, to avoid ambiguity.

* [Schedule] Allowed string argument to Schedule.reindex

Similar to https://github.com/apache/tvm/pull/11269, which added this
functionality to `Schedule.transform_layout`.

* CI test update
2022-06-09 13:34:32 -07:00
czh978 f528a9a1cd [Frontend][TFLite] Improve support for half_pixel_centers in resize (#11521)
* add resize_nearest_neighbor op test

* Improve support for half_pixel_centers in resize
2022-06-09 10:33:44 -07:00
Sunghyun Park 87502ddd90 [PASS] Refactor a couple of TIR passes - BindTarget, AnnotateEntryFunc, Filter, LowerInitBlock (#11628)
This PR fixes a few inconsistent pass registration and add testcases for them. 
- `LowerInitBlock` had mismatch between its pass name and ffi key.
- `BindTarget`, `AnnotateEntryFunc`, `Filter` were not following the name convention of tir passes and they were not registered in FFI registry.
2022-06-09 10:14:46 -07:00
FranckQC d8678a6a9a [TIR] CSE pass : Restrict the equivalence to be decided by a normal form - avoids comparison of terms (#11574)
The CSE pass had been designed for potentially allowing comparisons (and commonings) of equivalent terms (like (x+y)+z and x+(y+z)), where **the notion of being equivalent was customizable, and no assumption was made about it**. That means that the implementation of the equivalence test function `EquivalentTerms()` - which was at the moment just calling the syntactical equality test `EqualTerms()` - could be replaced later by a cleverer equality test.

However, having such a generic way of comparing elements meant that in the function `SyntacticToSemanticComputations()`, where we were going from a hashtable of syntactical entities to what I called a vector of "semantical entites" (which are just canonical forms/representants of classes of equivalence of terms), **the only way was to compare each pair**.
That resulted in a quadratic behavior of this function, but there was no way around it as in order to merge equivalent entities into their class of equivalence, we had to compare them.

**This PR essentially does the following:**

- When computing the classes of equivalences of terms (therefore transforming a ComputationTable (i.e. a hashtable) into a vector of classes of equivalence) : **instead of comparing each pair of terms, relies on a normalization procedure to obtain a normal form for each of them**.
That transforms a small part of the algorithm that was quadratic to n.logn. However, it's difficult to see improvements in practice, in particular for average sized programs, as that part was a "small" quadratic to a "big" n.logn (finding things in a hash-table, copying it to a vector, etc).
It was probably going from a complexity of ~O(((n²-n)/2) + n.logn) to a complexity of ~O(3n + n.logn), so potential gains would only be expected for very large programs.

- Completely gives the user the possibility to turn ON/OFF the semantical comparisons of terms. It is turned OFF by default (as it's quite longer to compile with it ON, unsurprisingly), which means that by default, the equivalence coincides with the (syntactical) equality of terms.
    As the pass was written with the possibility to do these additional commonings (like (x+y)+z and x+(y+z)), it was a good time to fully plug that completely, up to the Python user who can now turn that ON if he wants to. But again, it is OFF by default, so no real change on that.

To run it ON, simply do:
`with tvm.transform.PassContext(config={'tir.enable_equiv_terms_in_cse_tir':True}):`
before calling `build()`

- When this boolean is set to ON, it uses a simple implementation of the normalization function with equivalences that uses `arith::Analyzer::Simplify` as noted by in https://github.com/apache/tvm/pull/10544 . Note that this is not a real normalization procedure as it is incomplete (i.e., it is not guarantee to converge to the normal form), but it is correct, and it works well with most properties : associativity of +, distributivity of * on +, etc.

- Clarifies and enhance the test base for the pass. In particular, it adds the tests that were written in https://github.com/apache/tvm/pull/10544 but which did not make it through.

- Also add the test ( https://github.com/AndrewZhaoLuo/TVM-Sandbox/blob/19284ddbd6bb28af61c0c2aa8bb334c5c53731a7/tir/test_inconsistent_tir_lowering.py#L1 ) demonstrating the (older) non-deterministic lowering and put it into a proper test, as I found it useful for making sure that this does not happen again. It has been copied from https://github.com/apache/tvm/pull/10663 and only slightly adapted (in particular for doing the comparison of hashes automatically instead of printing them and relying on a human to compare them).
2022-06-09 09:32:15 -07:00
Egor Churaev 2f9d9b4e5c [OpenCL] Implement conv2d_winograd algorithm for Adreno (#11543)
* Implement conv2d_winograd algorithm for Adreno

* Implement gtest for OpenCL texture pool

* Implement conv2d_nhwc_winograd for Adreno

* Minor refactoring

* Fix lint

* Apply comments

* Apply comments

* Fix lint
2022-06-09 13:31:55 +09:00
Sevin F. Varoglu df4f4c0b4b [ONNX] Add ReduceSum opset13 support (non-dynamic) (#11606)
* [ONNX] Add ReduceSum opset13 support (non-dynamic)

* Add check

* Add support for constant axis

* noop

* Rework logic
2022-06-08 14:08:06 -07:00
Mehrdad Hessar 97e681dc34 [Hexagon] Add random string to workspace name (#11593) 2022-06-08 13:23:58 -07:00
billishyahao 9817338508 [BYOC][DNNL] Enable layer normalization in DNNL byoc. (#11508)
* Enable layer normalization in DNNL byoc.

* Added unittest for layer norm and make code compatible after introducing TensorRequisite(PR-11345)

* Fix lint issue

* Fix clang format issue
2022-06-09 04:12:36 +09:00
Xiyou Zhou 96a513cd97 Patch replay trace. (#11621) 2022-06-08 11:39:42 -07:00
Philipp van Kempen e19cf20054 TVMC: Allow to overwrite TVM_CONFIGS_JSON_DIR via environment variables (#11623)
If a non-default location for the build directory is used, e.g. set via TVM_LIBRARY_PATH
we need to provide the user a way to overwrite CONFIGS_JSON_DIR as well.
2022-06-08 14:21:29 +01:00
Kathryn (Jinqi) Chen 52d90da1d3 [MetaSchedule] TuningRecord Optional Arguments (#11598)
In some situations, such as before measuring the candidates, the arguments `run_secs`, `target`, and `args_info` in `TuningRecord` are not required. Per this request, the new `TuningRecord` API now accepts arguments in the order of `trace, workload, run_secs, target, args_info` with the last three being optional. Note that some tests might fail due to the change of argument order, so they might need to be adjusted accordingly.
2022-06-07 18:05:14 -07:00
Eric Lunderberg d490620085 [Hexagon][CI] Re-enable Hexagon tests in CI (#11613)
* [Hexagon][CI] Re-enable Hexagon tests in CI

These were enabled in https://github.com/apache/tvm/pull/11294, then
erroneously disabled in https://github.com/apache/tvm/pull/11313.
This applies the same fix as in
https://github.com/apache/tvm/pull/11294, checking the
`ANDROID_SERIAL_NUMBER` to determine if Hexagon tests can execute at
runtime, but using the refactored `pytest.skipif` messages introduced
in https://github.com/apache/tvm/pull/11313.

* Fixed circular dependency, but feels somewhat ugly
2022-06-07 17:16:37 -05:00
Xiyou Zhou 12440895e4 [MetaSchedule] Add Testing Script with ONNX Support (#11587)
This PR introduces 2 tuning script for meta schedule and auto scheduler tuning support with onnx files. Now we can easily introduce onnx models benchmarking with command line scripts. Sample tuning call looks similar to the following script

For Meta Schedule ONNX tuning:
```
python3 -m tvm.meta_schedule.testing.tune_onnx_meta_schedule \
    --model-name   "$MODEL_NAME"                             \
    --onnx-path    "$ONNX_PATH"                              \
    --input-shape  "$INPUT_SHAPE"                            \
    --target       "$TARGET"                                 \
    --num-trials   $NUM_TRIALS                               \
    --rpc-host     $RPC_HOST                                 \
    --rpc-port     $RPC_PORT                                 \
    --rpc-key      $RPC_KEY                                  \
    --rpc-workers  $RPC_WORKERS                              \
    --work-dir     $WORK_DIR                                 \
    |& tee         "$WORK_DIR/$MODEL_NAME.log"
```

For AutoScheduler ONNX tuning:
```
python3 -m tvm.meta_schedule.testing.tune_onnx_auto_scheduler \
    --model-name   "$MODEL_NAME"                              \
    --onnx-path    "$ONNX_PATH"                               \
    --input-shape  "$INPUT_SHAPE"                             \
    --target       "$TARGET"                                  \
    --num-trials   $NUM_TRIALS                                \
    --rpc-host     $RPC_HOST                                  \
    --rpc-port     $RPC_PORT                                  \
    --rpc-key      $RPC_KEY                                   \
    --rpc-workers  $RPC_WORKERS                               \
    --log-dir      $WORK_DIR                                  \
    |& tee         "$WORK_DIR/$MODEL_NAME.log"
```
2022-06-07 11:08:32 -07:00
Altan Haan 32a86f8304 [TOPI] TE implementation of LSTM using scan (#11531)
* TE implementation of LSTM in TOPI

* docstring

* lint

* add injective tags where applicable
2022-06-07 10:33:21 -07:00
Junru Shao 68dcecc926 [MetaSchedule] Evo Independence from TaskScheduler (#11590)
Per discussion with @Kathryn-cat, we realized that the current API
design could be verbose if we only want to tune a single task, in which
case a dummy task scheduler still needs to be established to supply
`EvolutionarySearch` with proper `CostModel` and `Database`. This PR
fixes this UX issue.
2022-06-06 20:02:18 -07:00
Tristan Konolige 9d6599c928 [PROFILER] Add configuration information to profiler (#11530)
Configuration is a place to store extra information related to the
specific profiler run. Right now it is just the executor used and the
number of threads. The roofline analysis also adds peak flops and peak
bandwidth.
2022-06-06 08:49:22 -07:00
Luke Hutton 1aac4d6826 [microNPU] Optimize separate padding operation for conv2d (#11468)
Optimizes a case where padding appears as a separate nn.pad operation followed by a qnn.conv2d. If possible, the nn.pad will be partitioned and offloaded together with the qnn.conv2d operation, as opposed to separately. As a fallback, both operations will be considered separately.

cc Mousius NicolaLancellotti ekalda manupa-arm
2022-06-06 14:10:22 +00:00
Luke Hutton 609d6af176 [microNPU] Fix output mismatch in Leaky ReLU (#11397)
* [microNPU] Fix output mismatch in Leaky ReLU

All codegen tests have been running with a representative dataset
between 0,1 which masked an output mismatch in Leaky ReLU when compared
to TFLite kernels. This issue can be replicated by replacing the
representative dataset range with something like -1,1.

To fix this mismatch, we use the same implementation for calculating
LUT values as Vela which uses arithmetic constrained to quantized
values, rather than the previously used floating point calculations.

Change-Id: I0ed52215acd27722873be609271971b6fc4aaef1

* fix lint

Change-Id: Ica7de0c000ee015e79fe10985b2ec7a9b341861f

* fix lint again

Change-Id: I005d90ad248bfff7090f99d161eefbdc962cba48
2022-06-06 13:29:07 +01:00
Kathryn (Jinqi) Chen 8a568bc823 [MetaSchedule] exposed method: TuneContextNodeInitialize (#11576)
I exposed the initialize() method for TuneContextNode on the C++ side and added a corresponding method to TuneContext class on the Python side, so that we do not need to call initialize_with_tune_context for every scheduling rule.
2022-06-05 19:44:52 -07:00
Junru Shao 9d2c9a7f64 [TIR] Schedule Primitive: Add-Unit-Loop (#11575)
In TE, a unit loop could be introduced by fusing an empty list of loops on a stage. This PR adds its counterpart in TIR, while being a bit more explicit with a new schedule primitive which adds a unit loop without impacting any existing functionalities.
2022-06-04 17:48:19 -07:00
Krzysztof Parzyszek 8823757f30 [TIR] Expose tir.call_cpacked in python (#11563) 2022-06-03 16:09:24 -05:00
Eric Lunderberg b885362c36 [CI] Refactor of tvm.testing.requires_* annotations (#11313)
* [CI] Improved skip messages when using @tvm.testing.requires_*

Previously, the same message was given regardless of why a test
couldn't be run.  This has been split up into separate checks for TVM
cmake options in `config.cmake`, enabled targets in `TVM_TEST_TARGETS`
environment variable, and checks for available hardware.

* Refactor to specify repeated feature marks, compile-only markers

* Fixed lint errors

* Import from contrib, not from a different import

* Removed use of requires_llvm() as a list of marks

* Corrected mark from requires_gpu to requires_cuda

* Adding missing "not"

* Added USE_CMSISNN as a requirement for corstone300.
2022-06-03 14:03:08 -07:00
Krzysztof Parzyszek 4811d702f3 [Hexagon] Register strategy for concatenate (#11562)
* [Hexagon] Register strategy for concatenate

* Restart CI
2022-06-03 15:23:32 -05:00
Mark Shields 9dceb4e191 [BYOC] Two helper passes for external codegen using RelayToTIR custom pass machinery (#11474)
* [BYOC] Two helper passes for external codegen using RelayToTIR custom pass machinery

(See https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6 for
context, which in turn is part of Collage (https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).

For reasons explained in the above thread I'm moving CUTLASS to be IRModule-at-a-time external codegen
using a custom RelayToTIR pass instead of the traditional function-at-a-time external codegen using
a relay.ext.cutlass registered function. This means some of the rewriing done on-the-fly by LowerTEPass now
needs to be done by the custom pass directly. This PR supplies two passes which ease that burden:
 - Before starting the CUTLASS-specific processing, make sure all "Compiler" attributed functions have
   unique global definitions (ie are outlined). Though functions start in this form after BYOC partitioning,
   under Graph and AOT compilation flows those functions are then inlined to pass through the 'codegen' keyhole
   which assumes the whole model is just one self-contained main function. This pass will undo that. (I gave up
   trying to just remove the inlining in the first place.)
 - After the CUTLASS-specific processing the now compiled "Compiler" attributed functions need to marked as
   'extern'. The te_compiler.cc uses the "ExternalSymbol" attribute for that, but since a) the symbol name
   is never needed, on the presense of the attribute is significant downstream and b) "ExternalSymbol" is
   easy to confuse with "global_symbol", I just replaced "ExternalSymbol" with "Extern" with an Integer(1)
   (cf "Primitive").

 The outlining pass is a little more general than necessary because it (will also) be used by Collage to
 rewrite the IRModule into optimally partitioned form while making maximal reuse of partition functions.
 Hence the abstract GlobalSymbolCache.

* - Andrew's comments
2022-06-03 13:19:53 -07:00
Tristan Konolige f31477f9c3 [FIX] Pad feature vectors to the same size in xgboost cost model (#11479)
* [FIX] Pad feature vectors to the same size in xgboost cost model

* add test

* more test

* explaination

* formatting
2022-06-02 16:47:20 -07:00
Tristan Konolige aff1312e36 [PROFILER] Fix percent compute bound calculation (#11542)
* [PROFILER] Fix percent compute bound calculation

Somehow the runtime was dropped from the percent compute bound
calculation. Tolerances on the test we bumped a little bit higher to try
and catch mistakes like this in the future.

* forgot print
2022-06-02 14:37:11 -07:00
Wuwei Lin 12a0f3edcf [TIR] Add schedule primitive ReIndex (#11515) 2022-06-02 14:34:23 -07:00
Jocelyn S 480fa744eb [Onnx] Round operator (#11446)
* banker round op added based off tutorial

* black'd onnx.py file

* retriggering CI with empty commit due to autoscheduler test failure

* removed youtube link in comments

* retriggering CI due to test failure that passed locally
2022-06-02 10:15:04 -07:00
ChunPing Chung 4f5ab57d34 [Frontend][ONNX] Fix softmax converter when input shape is dynamic (#11507)
* [Frontend][ONNX] Fix softmax converter when input shape is dynamic

* [Frontend][ONNX] mark dynamic softmax tests as xfailed with cuda
2022-06-02 09:28:38 -07:00
mhyang-pllab e60849c899 Add ceil shape registration (#11533) 2022-06-02 16:53:15 +09:00
Sergey e84f163f57 [TE] Optimized version of concatenation layer (#11341)
* [TE] Optimized version of concatenation layer
     1. Concat implemented using extern_op
     2. New tests added.
     3. Workaround to allow inline extern_op-s with other layers.

* *test fix

* test_any.py fix.

* test_forward.py from tensorflow fix.

* lint fix.

* Fixes after code review.

* New comment added.

* Lint fix.

* Another lint fix.

* Comments added.

* rebase issue fix.

* Restored previous state.

* Update after code review.

* After code review changes.

* lint review.

* Change strategy for cuda to fix tests.

* Rebase to main

* Comments changes after review.

* Some more comments fixes.

* One more error fix in comments.

* restart build
2022-06-02 05:13:41 +09:00
Nicola Lancellotti ee26ecf1d5 [microNPU] Add transform matrices and part matcher to identity op (#11453)
* [microNPU] Add transform matrices and part matcher to identity op

* Address comments

* Enable cascader in identity tests

* Address comments
2022-06-01 15:51:56 +01:00
Junru Shao a71536a130 [MetaSchedule] Enable Task Filtering (#11512)
This PR allows `relay.backend.MetaScheduleExtractTask` to take an extra argument `filter_func` which filters out tasks that don't need tuning. The counterpart of AutoScheduler is `traverse_to_get_io_tensors`.
2022-05-31 15:57:30 -07:00
Mehrdad Hessar 2252f958f7 [microTVM][ARM][Zephyr] Add CMSIS dependencies in Zephyr project build (#11362)
* Test with CMSIS build added

disabled conv2d_nhwc_dsp.arm_cpu for non integers workloads

added debugging feature to TempDirectory

* revert arm_cpu strategy changes

* Address Andrew comments

* change copy to include

* add cmsis_path only as project option
2022-05-31 13:27:01 -07:00
wrongtest c1b22eefb5 [Arith] Merge surjective/non-surjective iter mapping detections (#11287)
* simplify (x * 96) % 64 to (x * 32) % 64

* adapt merge mulmod opt for OffsetOf computation

* merge DetectIterMap and DetectIterMapPadded

* adjust related interfaces for IterMapLevel

* - check incompatible left paddings
- determine case like x % 16, x in [0, 5) to be non-surjective, since usages may treat the region extent as 16 by mistake.
- skip second round of rewrite when there is no padding
- fix some typo in comments

* rebase upstream
2022-05-31 11:50:00 -07:00
Steven S. Lyubomirsky bc14f26aca [Frontend][PyTorch][Bugfix] Ignore Cuda in PyTorch version number when comparing versions (#11511)
* Do not consider cuda in the PT version number

* Add docstring
2022-05-31 08:53:00 +09:00
Manupa Karunaratne 119afda634 [microNPU] add E2E tests with cascader wo striping (#11410)
This commit adds end-to-end tests using the cascader
w/o striping. It needed few adjustments to the order
in which the arugments are provided to the entry point
function in AoT when both memory pools and devices
are present.

Change-Id: I37e04afd635add895e317586f628a62cae75f3fa
2022-05-30 16:31:23 +01:00
Eric Lunderberg d0b3ec93f9 [TVMScript] Allow T.Buffer[] arg annotation to use int as shape (#11454)
* [TVMScript] Allow T.Buffer[] arg annotation to use int as shape

Both the function `tvm.tir.decl_buffer` and the TVMScript
`T.match_buffer` expression allow a `PrimExpr` to be passed as the buffer
shape, which is interpreted as a 1-d buffer of that size.  This allows
the same behavior to be used in the `T.Buffer` syntactic sugar.

(e.g. `A: T.Buffer[16, "float32"]` instead of `A: T.Buffer[(16,), "float32"`)

* Fixed round-trip when buffer size contains an expression
2022-05-30 16:13:50 +09:00
Wuwei Lin d4a396825b [TIR] Add schedule primitive TransformBlockLayout (#11485)
* [TIR] Add schedule primitive TransformBlockLayout

* fixup! [TIR] Add schedule primitive TransformBlockLayout

Fix doc
2022-05-29 12:12:17 -04:00
Masahiro Masuda 2389f1f0d8 [Software pipeline] Fix hardcoded index in access_ptr rewriting, add a GPU test with depth 4 (#11495)
* fixed hard-coded index in software pipeling

* fixed three-stage pipeline test

* add three stage pipelined gemm test

* refactor mma test

* use mma_4k schedule utility in test

* apply pipeling annotation

* black

* require ampere in test
2022-05-28 09:47:45 +09:00
Mark Shields afb67e64a1 Silence unnecessary 'host' deprecation warnings (#11499) 2022-05-27 17:10:40 -07:00
Yuanjing Shi 80d9549190 [Meta Schedule] Fix testing issues for models with more than one inputs (#11298) 2022-05-27 16:41:54 -07:00
Tianqi Chen 2e1666d386 [FFI][CYTHON] Release GIL when calling into long running functions (#11461)
Unlike ctypes, Cython by default do not release GIL when
calling into C API functions. This causes problems when the
function is long running. As the particular calling thread will
block other python threads by holding the GIL.

This PR explicitly releases GIL when calling into possible
long running functions. It fixes the timeout issue in
PopenPool which previously relied on another python thread
for timeout.

Added a regression test-case by changing sleep to sleep
in FFI, which previously will indefinitely block the popen tests.
2022-05-27 11:14:50 -07:00