HNHacker News
TopNewBestAskShowJobs

snnn

155 karma · joined May 21, 2012

submissionscomments
snnn··on Intel Arc A580 could be the next great affordable GPU
I think Intel has occupied the low-end laptop market. Nowadays nobody wants to build a laptop on ARM(except Apple). Chromebooks still have a large market, and they do not need any fancy GPU.
snnn··on ONNX runtime: Cross-platform accelerated machine learning
ONNX is a spec. ONNX Runtime is an implementation of ONNX. There are other implementations too. But ONNX is not a text spec like the RFCs for network protocols. ONNX is also a collection of C/C++ code. ONNX's implementations rely on this code to do type and shape inference. My point was: if someone wants to implement ONNX(write a library that can load and run ONNX models), he/she has to reuse this C/C++ code, or totally rewrite them in his/her favorite programming language(but I think it is not very practical).

If an ONNX implementation wants to do codegen, like what XLA does, then usually it is based on LLVM and it needs to be shipped with a copy of LLVM.

snnn··on Intel Arc A580 could be the next great affordable GPU
Bet on WebGPU. Intel and Google are the two main drafters of WebGPU spec. I can tell you that the card definitely will support WebGPU well, and WebGPU is not just for web. It will run on any device with a very small footprint runtime library and does not need a browser.
snnn··on ONNX runtime: Cross-platform accelerated machine learning
It is true if your model is statically shaped. ONNX is also a collection of C++ code , a C++ library for doing shape inference. You cannot project the C++ code to another high level programming language.
snnn··on ONNX runtime: Cross-platform accelerated machine learning
> I'm not sure if this is a file size limit too or just an object memory representation size limit.

Message. Each message cannot be bigger than 2GB(and usually should be not this big), but a file could contain multiple messages. This limitation helps them prevent integer overflows, since every length is 32-bit but every application process is 64-bit, you can convert the length numbers to 64-bit before doing any arithmetic operation. Therefore, fundamentally, there is no way to make it secure on 32-bit platforms, or no way to support more than 2GB on 64-bit platforms without totally rewriting the code.

snnn··on CPython, C standards, and IEEE 754
> The OS you are running the build on and the Xcode version don't influence that

Usually it doesn't. But in this special case it does. I have set the flag you said. When C++17 wasn't in the picture, it's enough. But now we are talking about how to enable developer using the new language features. New C++ features typically need new runtime. But the old systems do have it. Then one of the difficulty is how to figure out which macOS versions have it, which doesn't.

snnn··on CPython, C standards, and IEEE 754
If everyone just use the latest macOS and the latest iOS, I'm less concerned. But I haven't heard any IT manager enforcing that. macOS 12 has come out, but usually they still allows you using macOS 11 as long as you have installed all the security bug fixes.

For macOS and iOS, the problem is more complicated. Let's say I want to publish a package to pypi.org. The package contains some binaries compiled from C++ and it requires C++17. Then what is the lowest macOS version the binary can support?? It's very tricky that if the build machine which generates the package is macOS 11, then it can have Xcode 12.5. Otherwise it has to use XCode 12.4 or lower. And in XCode 12.4 it says std::optional, which is a C++17 feature, is only supported in macOS 10.14+. But if the build machine has macOS 11 and XCode 12.5, then the binary would be able to run on 10.13 too. And in whatever case, it can't support 10.12 or lower.

I believe you don't want to build tensorflow/pytorch packages from source. So the maintainers of these two OSS projects must consider the things above. If you wonder why they don't use C++17, this is the reason. For the same reason they want to avoid C11 optional features too.

snnn··on CPython, C standards, and IEEE 754
They don't handle bugs. If the bug is reproducible on RHEL, they will suggest you report the bug to RHEL. It scares people away. At this moment, the manylinux community is considering Rocky Linux and Alma Linux, but it's very hard for them to make the decision because of lacking direct support.
snnn··on CPython, C standards, and IEEE 754
As a user, if you build every python package from source, it's ok. But if you a maintainer of an OSS project and you need to publish binary packages for it, then you will hit the trouble. Binaries built on Ubuntu 20.04 can only support Ubuntu 20.04 and newer. So you'd better to choose an older Linux release to target broader users. Now most python packages choose CentOS 6 or 7. See https://github.com/pypa/manylinux/issues/1012 for more details. They need help!
snnn··on CPython, C standards, and IEEE 754
See: https://github.com/pypa/manylinux/pull/1135 .

Alpine is a supplement. It can't replace the others. It hasn't been widely accepted by the community yet. I believe many python projects are not afforded to replace libc.

snnn··on CPython, C standards, and IEEE 754
I don't know why GCC-12 was in the picture, but I hope all of you can understand one thing: python's source code must be compatible with GCC 6. And no so called "Threading [Optional]" features. It is all because CentOS is dead. CentOS has been sold to IBM. There is no CentOS 8 anymore. The free lunch is ended. And there wouldn't be another OSS project to replace it.

Linux kernel developers want to use C11. CPython developers want to use C11. But does your compiler support it? If you were a C++ developer, would you request C++17/C++20 also?

CPython must be aligned with the manylinux project. manylinux build every python minor release from source. Historically manylinux only use CentOS. CentOS has devtoolset, which allows you use the latest GCC in an very old Linux release. Red hat has spent much time on it. Now you can't get it for free because CentOS is dead. So the manylinux community is switching to Ubuntu. Ubuntu can only provide GCC 6 to them. If anycode in CPython is not compatible with GCC6, then manylinux will have to drop ubuntu too. And they don't have any other alternative. As I said, for now Red Hat devtoolset is the only solution. When IBM discontinued the CentOS project, most people do not understand what it means to the OSS community.

(I work for Microsoft. It doesn't stop me to love Linux.)

snnn··on A Saudi woman's iPhone revealed hacking around the world
I'd prefer to catch such errors at compile-time. More static the language is, more optimization/analysis can be made. Sometimes the problem can be simplified when your CPU is 64-bit capable but you limit array sizes to 2GB, then you can use 64-bit math to calculate memory sizes to avoid integer overflow. Java and Google protobuf are two such examples. Sometimes the 2GB limit is acceptable, sometimes it is not. You know protobuf even tries to limit string size to tens of MB for safety? The simplification can not be accepted as a general solution.

Back to your Raspberry Pi 4 example: The CPU is 64-bit, but most users only use 32-bit OS with it. Today most Linux installations are 64-bit. I believe Google doesn't care much on protobuf's security on 32-bit systems. So does the other OSS software. So if you take it seriously, it works but it is not safe(when we are talking integer overflow).

snnn··on Linux's GPLv2 licence is routinely violated (2015)
Firmware of TP-link routers is licensed under GPL. But would anyone of you get the source code? They say they provide machine-readable source code. I don't quite understand what it means.
snnn··on A Saudi woman's iPhone revealed hacking around the world
I think the most critical part in the flow is the integer overflow bug, and it is totally avoidable. I am a software engine at Microsoft. Half of my time was spent on security and compliance. We have the right tool, right policy to avoid such things happen. However, I'm not saying Microsoft software is free of integer overflow bugs. I don't intend to advertise Microsoft C/C++ development tools here, but they are the ones I know most.

Let's go to the technical part: If you are asked to implement the binary algorithm with your favorite programming language, how do you verify your code? Unit-tests. How many test cases you will need? More than 10. Binary search implementations are easy to suffer integer overflow bugs(remember the one in JDK?), as long as you have enough tests, your don't need to worry too much. But how much is enough? People can't implement binary search correctly in decades is not because we don't know the algorithm enough or we don't have excellent software engineers, it is because w don't know how to test our code thoroughly. Any non-trivial C/C++ function may need tens of thousands test cases. Simply you can't write them by hand.

You need the right tools: fuzzing and static analysis.

At Microsoft, every file parser should go through fuzzing, which basically is you generate some random input, then you run your tests with the random inputs. Not very fantastic. But there is another kind of fuzzing: symbolic execution, which tries to find all the possible execution paths of your code. If you run symbolic execution with your binary search code, you can get 100% test coverage. And it is guaranteed bug-free. It is like a math proof. Please note the advantage is based on human just had surprising great advancement on SAT solvers in the last 20 years. And often you need to make some compromises between your business goal and security. Most functions can't reach 100% test coverage. You need to simplify them. See https://github.com/klee/klee to get a quickstart. Though C/C++ is often considered unsafe, they have the best fuzzer.

Then it is about SAL annotation and static analyzer. In C, whenever you pass a pointer of an array to another function, you should also pass its length with it. And in the callee function you should check the length. If you forgot it, your static code analyzer will give you a warning. In such a sense, if you didn't allocate enough memory, it will only result an error code being returned instead of undefined behavior.

The last thing: Use safeint wrapping your malloc function. https://docs.microsoft.com/en-us/cpp/safeint/safeint-library...

When we move off the binary search toy example to a real code base, clearly you can see how much extra effort is needed to make the code safe. Please pardon me, most OSS libraries don't have the resource. Many famous OSS projects are "Mom-and-pop" shops. They don't have any compliance rule. They invest very little on fuzzing. So the big companies really should help them. Now you see an integer overflow bug was found in Apple's image render, but was the code written by Apple? Not necessarily. Now we all see the importance of the Open Source movement. It's time to think how to harden their security. For example, even I want to spend my free time on adding SAL annotations to an OSS project I love, would the maintainers accept it?

snnn··on Why can’t I play Ultra HD Blu-ray movies on my new Intel CPU platform?
I believe any DVD drive made in recent years won't support it. Some drives had bugs in their old firmware so that the drives can be used with makemkv, but it doesn't mean it is usual. They can fix the bugs. They can stop making problematic hardware. Even if you can find such a hardware, it might be more expensive than your CPU. Normally people won't invest much on it.

And, like what SGX is providing, if the film industry really want to stop pirating, they can. Then makemkv will be a history.

snnn··on Wikimedia is moving to Gitlab
Gitlab has no business in China.
snnn··on WHO declares coronavirus outbreak a public health emergency
In 2018, China had 600k flu cases and 153 deaths. So the new virus has caused 10 times more deaths in this Jan. Is it serve?

See: http://www.nhc.gov.cn/jkj/s3578/201904/050427ff32704a5db64f4...

snnn··on Ask HN: Where do you read C++ documentation?
MSDN and man pages. All the other sources are second handed.
snnn··on Ask HN: Traveling to China for the first time. Would love some advice
Hi, I'm in Beijing, I have been here for ten years. We can meet in person if you want. I could be your local guide for free because I want to improve my English. My email is me at cpp dot io .

For your first question, you can setup an openvpn on Azure or AWS before you leave. Are you using iphone or Android? From what I know, it only works on Android and PC.

snnn··on Intel offers Parallel STL implementation to GNU libstdc++
So they want TBB be part of gcc?
snnn··on The System Bottleneck Shifts to PCI-Express
Have you tested the numbers?
snnn··on Go's work-stealing scheduler
Tensorflow has the same thing from Eigen
snnn··on Can FPGAs Beat GPUs in Accelerating Next-Generation Deep Learning?
there are opencl,blas libraries. You don't have to do everything from the beginning.
snnn··on LLVM 4.0.0
VS is slowing down. VC++ 2017 is VC++ 14.1, not 15.0
snnn··on Google will kill Python 3, and it might be a good thing
Most of their official examples do not work in Python 3. https://github.com/tensorflow/models
snnn··on Intel to more actively engage with FreeBSD Foundation and make $250K donation
BTW, Microsoft is also a major supportor of Freebsd foundation.
snnn··on Revisiting 64-bit-ness in Visual Studio and elsewhere (2015)
Thanks for your help.
snnn··on Revisiting 64-bit-ness in Visual Studio and elsewhere (2015)
I already set toolset to x64. It's 64 bits cl.exe running.
snnn··on Revisiting 64-bit-ness in Visual Studio and elsewhere (2015)
Right now, I'm fighting with: "fatal error LNK1248: image size (1004CB720) exceeds maximum allowable size (FFFFFFFF)" :-(
snnn··on XLA: linear algebra library for TensorFlow
TF has runtime cost based optimization, which is inside Session.run()
← PreviousPage 2 of 4Next →