Is it possible to create an LLVM target backend for a custom 19-bit processor, without having to write too much code in the LLVM source? Is this a correct DataLayout for LLVM, or it has to be multiples of 8-bit, e.g., 16 or 32?
DataLayout("e-p:19:19-a19:19")
It's not only the 19 bits though... Doesn't this custom CPU have its own instruction set? Register set? Addressing modes? ABI?
For a new target CPU, you have to implement a new Target in LLVM. See http://llvm.org/docs/CodeGenerator.html and http://llvm.org/docs/WritingAnLLVMBackend.html to get started.
Related
I'm currently writing a custom DNN kernel to run on ARM-based devices. (Using C++, with GCC 7.5.0)
My code slices the given workload into batches that would fit in the last level cache, in an effort to reduce main memory accesses.
I've successfully implemented the code to work on my development board with the given cache size from the manufacturer, but the binary is expected to run on multiple environments, each possibly with different cache configurations.
Is there a way for my program to know the last level cache information of the given system on runtime? Maybe a system call?
The expected environment is ARMv8-A (on aarch64 mode), probably with Linux Kernel 4.3 and up.
I have tried /proc/cpuinfo , getconf , cpuid , lscpu , lshw , and although these work fine on my x86 based desktop, none of these return any info about cache sizes on my development board. (Odroid N2+, Ubuntu 18.04, Linux 4.9.230).
I can't get the CPU ID or motherboard serial number in all operating system (cross platform Qt)
On Windows I'm using WMI and on Mac another. I want use a cross-platform library.
Although Qt detects at runtime the CPU feature set (cf. src/corelib/tools/qsimd.cpp), it does not export any function to access that (nor any other CPUID information). Write your small piece of assembly code to gather that information. - source
You will have to write some platform dependent code to retrieve this information.
For the CPU id you should probably look into the function __cpuid() for Windows and this answer can help you out on getting it for Linux.
Doing this you might want to consider reading up on motherboard serial numbers as not all of them provide this information at the same place (most do not provide it at all).
You can execute this command :
"wmic cpu get ProcessorId"
Qt 5.11 introduced this function: QSysInfo::machineUniqueId
I work with a PCIe board that requires 256 byte TLP payload size. I got CPU that supports that (Core i7-3930K) and Intel motherboard, DX79SR that does not offer TLP payload size setting in BIOS.
By default there is 128 byte max TLP payload and I need to change it to 256 byte, without BIOS. I found PCIUtils software that displays this value in Windows but it's a multi-purpose portable software and it's too complicated to find what I need.
Intel documents describe what values I need to set in CPU I/O registers and there is another document saying that I/O locations are C8Fh and CFCh.
This is where I'm stuck, I don't know where to start if I want to set to set these registers.
I am an experienced Windows S/W developer but I have never dealt with drivers. I do have source code for the drivers of this PCIe board that I can modify, build and run but I have no idea how to write data to I/O registers of Intel CPU. I have found that _outp() functions don't work in user mode though.
Please point me where to start, either from executable (easier) or driver. I think all I need is to do is to read/write from I/O ports C8Fh and CFCh, if I'm not mistaken. It's Windows XP 32 bit now, Win7 x64 will be later, Visual Studio 2010 C++ or WDK.
Basically what you have to do is use the out, respectively in x86 asm instructions. The thing is that in protected mode those two instructions are locked so that you can't use them in userland mode.
The best place to start is to get the WDK (windows driver kit) and look at their samples (you only need a software driver for this). If the driver for the PCI board is a kernel mode driver though you could just add the calls in the DriverEntry function and be done with it.
If that's not an option, you'll have to build your own software kernel mode driver - here is some simple example code with instructions on how to build and deploy one. The actual code should be trivial, since you only want to execute some instructions in kernel mode.
I'm trying to compile Boost 1.49.0 for WinRT. I've got it down to one method: GetSystemInfo(), which is used in boost::thread::hardware_concurrency() to obtain the number of logical processors on the system.
I haven't found any replacement in WinRT yet.
Is there an alternative method I could use?
You can call the Windows API function GetNativeSystemInfo, which is permitted in Metro style apps.
There doesn't seem to be a simple way to get this information in WinRT. If you just want to know the processor architecture then you can use Windows.System.ProcessorArchitecture but this will not tell you how many logical CPUs are available. Windows.System.Threading doesn't tell you this information either.
To get information about the physical CPU I've found this question on the MSDN forum which suggests that we can use DeviceEnumeration to get to this information. By using the GUID for GUID_DEVICE_PROCESSOR ({97FADB10-4E33-40AE-359C-8BEF029DBDD0}) you can enumerate over all processors.
In Javascript this should look something like this - for a C++ example see the Device Enumeration example on MSDN:
Windows.Devices.Enumeration.DeviceInformation.findAllAsync('"System.Devices.InterfaceClassGuid:="{97FADB10-4E33-40AE-359C-8BEF029DBDD0}""')
.then(function (info) {
for (var i = 0; i < info.length; i++) {
var device = info[i];
}
});
On my machine this gives me all sorts of devices, sound card, PCI and USB processors so I'm not sure if there is a better way to just get the CPU but I did get the info what CPU I have
"Intel(R) Core(TM) i7 CPU Q 740 # 1.73GHz"
Unfortunately this info doesn't seem to include a simple flag that tells you the number of CPUs and therefore I think it would be difficult to get to a number of logical CPUs. I suggest you ask on the MSDN forum. They are usually quite responsive.
System.Environment.ProcessorCount should give you the number of cores.
I want to find the interface supplied by windows to change the CPU frequency and core voltage.
Thanks!
you can change frequency by using
PowerWriteACValueIndex()/PowerWriteDCValueIndex()
when setting the same index value for both
GUID_PROCESSOR_THROTTLE_MAXIMUM | GUID_PROCESSOR_THROTTLE_MINIMUM
all the GUID description could be found in winnt.h
you cannot change CPU voltage by WINAPI. you should use the privileged commands to write to specific MSRs (see AMD/Intel docs) via system kernel driver.
you cannot change Intel CPU voltage AT ALL since Nehalem micro-architecture. Intel officially does not supply MSRs to write voltage values (VIDs) by software.
From Windows Native Processor Performance Control(document link)
Parameters to P-state policy
Several parameters to Windows processor performance state controls are configurable via registry keys. These keys are provided with the intent that OEMs and system designers may tune the performance of Windows processor power management features to best suit specific platform designs, and allow adjustment to help achieve maximum battery life and realize the best system performance.
And you have to restart to have the changes take effect.
Microsoft Windows does not have an API for overclocking / underclocking a CPU. You would have to roll your own using your assembler skills.
I can do no more than point you in the right direction. I think through Windows Management Instrumentation (WMI) you can get at a COM interface that allows modification of some sub-systems.
Hopefully that vague bit of information will set you on the right path. :-)