sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: rust
Issue: Inconsistent optimization
Labels: A-LLVM,I-slow,C-enhancement,T-compiler,C-optimization

```rust
use std::ops::*;

pub struct Number([u64; 4]);

impl Add for Number {
    type Output = Self;

    #[inline]
    fn add(self, other: Self) -> Self::Output {
        let mut accum: Self::Output = unsafe { core::mem::uninitialized() };
        let mut carry = false;

        for i in 0..self.0.len() {
            let x = self.0[i] as u128 + other.0[i] as u128 + carry as u128;
            carry = x > core::u64::MAX as u128;
            accum.0[i] = x as u64;
        }

        accum
    }
}

pub fn add_a(l: Number, r: Number) -> Number {
    l + r
}


pub fn add_b(l: [u64; 4], r: [u64; 4]) -> [u64; 4] {
    let mut accum: [u64; 4] = unsafe { core::mem::uninitialized() };
    let mut carry = false;

    for i in 0..4 {
        let x = l[i] as u128 + r[i] as u128 + carry as u128;
        carry = x > core::u64::MAX as u128;
        accum[i] = x as u64;
    }

    accum
}

impl Sub for Number {
    type Output = Self;

    #[inline]
    fn sub(self, other: Self) -> Self::Output {
        let mut accum: Self::Output = unsafe { core::mem::uninitialized() };
        let mut carry = false;

        for i in 0..self.0.len() {
            let x = self.0[i] as u128 - other.0[i] as u128 - carry as u128;
            carry = x > core::u64::MAX as u128;
            accum.0[i] = x as u64;
        }

        accum
    }
}

pub fn sub_a(l: Number, r: Number) -> Number {
    l - r
}


pub fn sub_b(l: [u64; 4], r: [u64; 4]) -> [u64; 4] {
    let mut accum: [u64; 4] = unsafe { core::mem::uninitialized() };
    let mut carry = false;

    for i in 0..4 {
        let x = l[i] as u128 - r[i] as u128 - carry as u128;
        carry = x > core::u64::MAX as u128;
        accum[i] = x as u64;
    }

    accum
}
```

https://godbolt.org/z/aqhD1B

The above link demonstrates four functions of the same algorithm. The generated assembly is widely divergent based on context. It would be great if rust could output the same code for all of them. Alternatively, someone could recommend an algorithm that produces consistent output.
Repository: pytorch
Issue: Construction of MultivariateNormal much slower on GPU than CPU
Labels: module: performance,module: distributions,module: cuda,triaged

## 🐛 Bug

Constructing a MultivariateNormal distribution is much slower when inputting GPU-based `FloatTensor`s than CPU-based ones.

On my machine the GPU version is ~33x slower than CPU.

## To Reproduce

Steps to reproduce the behavior:

```
import time
import torch
from torch.distributions.multivariate_normal import MultivariateNormal

mu = torch.FloatTensor([2, 4])
sigma = torch.FloatTensor([[5, 0], [0, 2]])

mu_gpu = mu.cuda()
sigma_gpu = sigma.cuda()

num_runs = 1000
t_cpu, t_gpu = 0, 0
for _ in range(num_runs):
    st = time.perf_counter()
    m1 = MultivariateNormal(mu, sigma)
    t_cpu += time.perf_counter() - st

    torch.cuda.synchronize()
    st = time.perf_counter()
    m2 = MultivariateNormal(mu_gpu, sigma_gpu)
    torch.cuda.synchronize()
    t_gpu += time.perf_counter() - st

print(f'[CPU] Time Taken: {t_cpu}s')
print(f'[GPU] Time Taken: {t_gpu}s')
```

Output on my machine:
```
[CPU] Time Taken: 0.08132426194060827s
[GPU] Time Taken: 2.7058167830073216s
```

## Expected behavior

I'd expect the GPU to be faster, or at least of a comparable speed to CPU.

## Environment

```
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176

OS: Pop!_OS 18.10
GCC version: (Ubuntu 8.3.0-6ubuntu1~18.10) 8.3.0
CMake version: version 3.12.1

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: GeForce GTX 1070 With Max-Q Design
Nvidia driver version: 410.78
cuDNN version: /usr/lib/cuda-10.0/lib64/libcudnn.so.7.4.1

Versions of relevant libraries:
[pip3] numpy==1.17.0
[pip3] torch==1.1.0
[pip3] torchvision==0.3.0
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl_fft                   1.0.12           py36ha843d7b_0  
[conda] mkl_random                1.0.2            py36hd81dba3_0
```
Repository: scrcpy
Issue: Request: offer more options for drag&drop of files
Labels: feature request

When right-button drag&drop, it could offer us various options:
1. push to main storage path (important for APK files, as the normal behavior is to install them)
2. push to Download folder
3. For single APK file, install&run. 
4. Same as #3, but also grant permissions (use the "-g" parameter)
5. For multiple APK files, install&grant-permissions
6. Push and share
7. Push and open

As for the definition of "run", it depends. On most apps, it's the main Activity to launch.
On some, there is no such an Activity. On such cases, it depends on what is the app. If for example, it's a live wallpaper app, it should show the chooser. If it failed to find how to "run" the app, nothing should occur, except maybe tell the user that we can't find any way to "run" the app.
Repository: rust
Issue: rustdoc: explicit marker trait impl bounds are not simplified
Labels: T-rustdoc

Rustdoc currently renders automatic and explicit marker trait implementation bounds differently, for automatic implementations the bounds are simplified down to their most fundamental requirements, while explicit implementations show exactly what is specified.

As an example, here are two identically defined structs (`Bar` and `Baz`), one uses the automatic implementation for `Send` while the other has the same implementation explicitly defined, in both cases the direct requirement is `Foo<T>: Send` which can be simplified down to `T: Send` by looking at the bounds on `Foo`:

```rust
pub struct Foo<T>(T);

pub struct Bar<T>(Foo<T>);

pub struct Baz<T>(Foo<T>);

unsafe impl<T> Send for Baz<T> where Foo<T>: Send {}
```

and the associated `impl Send` renderings:

![bar-send](https://user-images.githubusercontent.com/81079/62451443-970ce100-b76e-11e9-9035-7bb400e83356.png)

![baz-send](https://user-images.githubusercontent.com/81079/62451450-996f3b00-b76e-11e9-9014-9506180d1d07.png)

This will become more relevant if RFC 2145 is ever implemented, that [should allow bounds to refer to private types](https://github.com/rust-lang/rfcs/pull/2353#issuecomment-369224212) in which case there is no way to go from the `impl Send for Baz` in the docs to see what the actual requirements are (but it is already possible to simulate that today if `Foo` is moved into a private module).

This is also an issue for the proc-macro in https://github.com/taiki-e/pin-project (cc @taiki-e), that produces an explicit implementation for `Unpin` that must refer to the field types so that it can work generically for any struct.
Repository: go
Issue: proposal: x/tools: tool to audit diffs in dependencies
Labels: Proposal,modules

One of the key points from https://github.com/golang/go/issues/30240 is:

> Saved module caches do not interoperate well with version-control and code-review tools.

This point is further developed in https://github.com/golang/go/issues/30240#issuecomment-516735768. 

Raising this issue as a placeholder for the discussion about this specific point, because this point has a life well beyond and decisions on `vendor` and is relevant (by and large) to all users of Go.

_Please add to/edit this description as required - this is just a placeholder_
Repository: node
Issue: http: OutgoingMessage streamlike
Labels: http,stream

http `OutgoingMessage` is missing some methods, properties and behaviours to make it "truly" "streamlike":

- [x] `destroyed`
- [x] `writableLength` (https://github.com/nodejs/node/pull/29018)
- [x] `writableHighWaterMark` (https://github.com/nodejs/node/pull/29018)
- [x] `writableCorked`
- [x] `writableObjectMode` (https://github.com/nodejs/node/pull/29018)
- [x] `cork()` (https://github.com/nodejs/node/pull/29053)
- [x] `uncork()` (https://github.com/nodejs/node/pull/29053)
- [ ] `ERR_STREAM_DESTROYED`  (https://github.com/nodejs/node/pull/31818)
- [ ] `instanceof Writable` (issue https://github.com/nodejs/node/issues/28971)

Furthermore the destroy event ordering does not seem to be fully consistent with the stream implementation (needs further investigation).
Repository: thefuck
Issue: Add support for brew command not found
Labels: enhancement,help wanted,osx,hacktoberfest

can you add support for https://github.com/Homebrew/homebrew-command-not-found ?
Repository: pytorch
Issue: Better version of chrome://tracing
Labels: module: docs,triaged,small

## 📚 Documentation

Our friends at Google (specifically, Android) have built a wasdwebassemblyl-based tracing tool at https://ui.perfetto.dev/#!/viewer (source code to manually trace at https://android.googlesource.com/platform/external/perfetto/+/refs/heads/master/test/client_api_example.cc).

I think PyTorch could make use of that, or at least point to it in its documentation?

Example of uploaded trace: https://ui.perfetto.dev/#!/?s=c33b3f7ea24e145ed13a52196e1eb5e121334d53c7de6cedead7387a5f3c72
Repository: rust
Issue: Tracking issue for {Rc, Arc}::get_mut_unchecked
Labels: T-libs-api,B-unstable,C-tracking-issue,requires-nightly,Libs-Tracked

On `Rc` and `Arc` an new unsafe `get_mut_unchecked` method provides `&mut T` access without checking the reference count. `Arc::get_mut` involves multiple atomic operations whose cost can be non-trivial. `Rc::get_mut` is less costly, but we add `Rc::get_mut_unchecked` anyway for symmetry with `Arc`.

These can be useful independently, but they will presumably be typical when uninitialized constructors (tracked in https://github.com/rust-lang/rust/issues/63291) are used.

An alternative with a safe API would be to introduce `UniqueRc` and `UniqueArc` types that have the same memory layout as `Rc` and `Arc` (and so zero-cost conversion to them) but are guaranteed to have only one reference. But introducing entire new types feels “heavier” than new constructors on existing types, and initialization of `MaybeUninit<T>` typically requires unsafe code anyway.

PR https://github.com/rust-lang/rust/pull/62451 adds:

```rust
impl<T: ?Sized> Rc<T> { pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {…} }
impl<T: ?Sized> Arc<T> { pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {…} }
```

---

## Open questions

- [ ] Rename to `get_unchecked_mut` to match https://doc.rust-lang.org/std/?search=get_unchecked_mut ?
Repository: flutter
Issue: Deprecate and remove setSurfaceSize
Labels: a: tests,framework,c: API break,c: proposal,P2,team-framework,triaged-framework

You can do the same with `physicalSizeTestValue`.

History: "setSurfaceSize was first IIRC, and physicalSizeTestValue was second. The first solved the specific problem of setting the size of the test surface. The second allowed you to just override anything on the Window."
Repository: flutter
Issue: [Web] debugPrintStack has dart:sdk_internal frame on top of stack
Labels: dependency: dart,platform-web,has reproducible steps,P3,found in release: 3.10,found in release: 3.12,team-web,triaged-web

Stacktrace.current is included when calling Stacktrace.current for web platform but is skipped for VM/AOT.

## Steps to Reproduce

Disable skip:isBrowser in test/foundation/assertions.dart
Repository: go
Issue: go/printer: deletes or inserts AST types into code
Labels: NeedsInvestigation

Forked from https://github.com/golang/go/issues/31291.

We have found that `go/printer.Fprint` will delete broken code. 
An example of code being deleted: https://play.golang.org/p/WKRt74denE0.

We have also found that `go/printer.Fprint` will insert the string literal `BadStmt` or `BadExpr` in broken code that parses into `*ast.BadStmts` or `*ast.BadExprs`.
An example of code being rewritten: https://play.golang.org/p/_BBrwbfAtEH.

This was discovered through using the function `go/format.Node`, which uses `go/printer.Fprint`. We noticed that `format.Source` returns an error in such cases, which is the behavior I would expect. I would have expected that `format.Source` and `format.Node` would behave the same on the same input.
Repository: godot
Issue: Can't compile Godot with asan, lsan, ubsan and disabled vorbis
Labels: bug,topic:buildsystem

**Godot version:**
3.2.dev.custom_build 7126654ea

**OS/device including version:**
Ubuntu 18.04 GCC 7.4, clang 6.0

**Issue description:**
Commands
```
scons p=x11 -j6 use_llvm use_lsan=yes use_asan=yes use_ubsan=yes module_vorbis_enabled=no
```
Errors
```
Ranlib Library         ==> core/libcore.x11.tools.64s.a
[Initial build] Linking Program        ==> bin/godot.x11.tools.64s
/usr/bin/ld: modules/libmodules.x11.tools.64s.a(video_stream_theora.x11.tools.64s.o): undefined reference to symbol 'vorbis_block_clear'
//usr/lib/x86_64-linux-gnu/libvorbis.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
scons: *** [bin/godot.x11.tools.64s] Error 1
scons: building terminated because of errors.
```
```
anlib Library         ==> core/libcore.x11.tools.64.llvms.a
[100%] Linking Program        ==> bin/godot.x11.tools.64.llvms
[100%] /usr/bin/ld: modules/libmodules.x11.tools.64.llvms.a(video_stream_theora.x11.tools.64.llvms.o): undefined reference to symbol 'vorbis_block_clear'
//usr/lib/x86_64-linux-gnu/libvorbis.so.0: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.x11.tools.64.llvms] Error 1
scons: building terminated because of errors.
```
Repository: go
Issue: regexp: optimize for provably too long inputs
Labels: Performance,NeedsInvestigation

As a complement to #31329, we should find out what the maximum length of matchable inputs is at compile-time (when it exists) and return very early.

Some patterns for which this can be computed:
- `^a{2,5}$` (max length 5)
- `^((aaa)|(aa))$` (max length 3)
- `^.$` (max length `utf8.UTFMax`=4)
Repository: pytorch
Issue: Make MultiProcessTestCase pickable
Labels: oncall: distributed,module: tests,triaged,better-engineering

## Issue description

If MultiProcessTestCase is pickable, there is no need to hack testMethod in order to launch several processes.
And there will be no need to write duplicate terminated process status checking code.

## Code pointer

https://github.com/pytorch/pytorch/blob/725d6cd8cec9f2d2c60b8b09bf6384b38612e85a/test/common_distributed.py#L104-L161

## References

Discussion happened in #23660

[Python docs](https://docs.python.org/3/library/pickle.html#pickling-class-instances)
Repository: pytorch
Issue: [quantization] jit::class_ for packed weights
Labels: oncall: jit,triaged,quantization_release_1.3,jit-backlog

<to be filled in>

cc @suo
Repository: TypeScript
Issue: PositionError does not match docs in MDN
Labels: Bug,Domain: lib.d.ts

**TypeScript Version:**  3.5.3

**Search Terms:**
PositionError, Geolocation

**Code**

```ts
const positionError: PositionError = {
    code: 1,
    message: ''
}
```

**Expected behavior:**
Compiles successfully as this matches the docs here: https://developer.mozilla.org/en-US/docs/Web/API/PositionError

**Actual behavior:**
`Type '{ code: number; message: string; }' is missing the following properties from type 'PositionError': PERMISSION_DENIED, POSITION_UNAVAILABLE, TIMEOUT`

**Playground Link:**
https://www.typescriptlang.org/play/#code/MYewdgzgLgBADiCBLKTwFEBOmSYFwwAKiKaYWOmMAvDAN4BQMzMoAJgKYECMANEywC2HCBACGAcy4wA5DIYBfBkA

**Related Issues:**
None
Repository: pytorch
Issue: Fan out calculation broken for group (depthwise) convolution
Labels: module: convolution,triaged,module: initialization

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

```python
# depthwise, should be (9, 9)
m = torch.nn.Conv2d(4, 4, 3, groups=4)
print(torch.nn.init._calculate_fan_in_and_fan_out(m.weight))

# groupwise, should be (18, 9)
m = torch.nn.Conv2d(4, 2, 3, groups=2)
print(torch.nn.init._calculate_fan_in_and_fan_out(m.weight))
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

1. Should return `(9,9)` instead of `(9, 36)`
1. Should return `(18, 9)` instead of `(18, 18)`

<!-- A clear and concise description of what you expected to happen. -->

## Environment

 - PyTorch Version (e.g., 1.0): 1.3.0
 - OS (e.g., Linux): Linux
 - How you installed PyTorch (`conda`, `pip`, source): pacman
 - Build command you used (if compiling from source):
 - Python version: 3.7
 - CUDA/cuDNN version: None
 - GPU models and configuration: None
 - Any other relevant information: None

cc @ezyang @gchanan @zou3519
Repository: go
Issue: encoding/csv: do not use bufio.Writer in csv.Writer
Labels: Performance,NeedsInvestigation

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.12.6 linux/amd64

</pre>

### Does this issue reproduce with the latest release?

Yes


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build056785781=/tmp/go-build -gno-record-gcc-switches"

</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

Consider this situation, in my program, down to the lowest call, i need to convert my `Record`  to csv string, so I use `csv.NewWriter`  and pass it with bytes.Buffer, and i Write my record, and Flush, at last, i got the csv string from bytes.Buffer.   Everything is fine and great for now. But, after benching, I found my program running very slowly, and the bufio used in csv.Writer is the performance killer. Because for each record, bufio.defaultBufSize length of slice is maked, and it is not easy to prevent from this slice allocing.

### What did you expect to see?

Leave the choice of using bufio or not to the user.

in stdlib, use raw io.Writer, and if user want to use bufio. just wrapp it like this:
```
w := csv.NewWriter(bufio.NewWriter(os.Stdout))
```
Repository: pytorch
Issue: CUDA: THTensor code complains about devices not matching when creating tensor from blob
Labels: module: cpp,triaged

## 🐛 Bug

Despite pytorch being able to work out that the storage of the device is actually "cuda:1" (this is where it was created!), it assumes it was on "cuda:0" and complains about it.
If I set the index to -1 (default), it should use the pointer to work out the device index and bypass any complaints. Instead, it makes this assumption about cuda:0 (which is not mentioned anywhere in my code).

Error:

> Attempted to set the storage of a tensor on device "cuda:0" to a storage on different device "cuda:1".  This is no longer allowed; the devices must match. (THTensor_stealAndSetStoragePtr at ..\..\aten\src\TH\THTensor.cpp:116)


Related: #19007

## To Reproduce

Steps to reproduce the behavior:

```
torch::Tensor matToTensor(const cv::cuda::GpuMat &image, const bool mean)
        {
            std::vector<int64_t> dims = {image.rows, image.cols, image.channels()};
            std::vector<int64_t> strides = {image.step1(), image.channels(), 1};
            auto options = torch::TensorOptions().dtype(torch::kFloat).device(torch::kCUDA).device_index(-1);
            torch::Tensor tensorImage;
            return torch::from_blob(image.data, dims, strides, deleter, options);
}
```


<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```

 - PyTorch Version (e.g., 1.0): 1.2.0-pre
 - OS (e.g., Linux): Windows
 - How you installed PyTorch (`conda`, `pip`, source): nightly
 - Build command you used (if compiling from source): N/A
 - Python version: N/A
 - CUDA/cuDNN version: 10.0/7.5
 - GPU models and configuration: RTX 2060
 - Any other relevant information:

## Additional context
Repository: flutter
Issue: Using escape characters in variable strings
Labels: framework,dependency: dart,a: typography,P2,team-framework,triaged-framework

While this could be more of a SO-type question, [I have posted there already to no useful response](https://stackoverflow.com/questions/57213902/new-line-n-not-being-respected-when-reading-from-sqflite-result) so I'm out of options and this is currently a blocker for many of our production apps that rely on data-driven icons and string formatting.

I'm trying to use escape characters in both SQFlite data and from other model class variables, neither of which seem to work at all.

For example, I have a FontAwesome .ttf that I'm trying to render fonts from by referencing the unicode characters  eg. `\uf535'. If I hardcode the text value like this:

```dart
RichText(
  text: "\uf535"
)
```
then the icon renders correctly, but doing:

```dart
class Model {
  String iconString = "\uf535";
}

RichText(
  text: "${model.iconString}"
)
``` 
renders the literal string, and no icon/escape formatting works at all. Is there some sort of trick to getting this to work or is something going funky somewhere?
Repository: flutter
Issue: [video_player] Add Windows support
Labels: c: new feature,platform-windows,customer: crowd,p: video_player,package,c: proposal,a: desktop,P2,has partial patch,team-windows,triaged-windows

When does the video player plugin support the Windows platform? Is there any plan support?

## Current status (as of October 2024)

There is an in-progress PR (https://github.com/flutter/packages/pull/5884), but it needs more work to be landable, and is not currently under active development. Anyone interested in moving the PR forward is welcome to contribute.